[REBOL] Re: Working with large files
From: tim-johnsons::web::com at: 11-Aug-2008 12:36
Hi Brock:
Have you tried using 'open instead of read?
I use open with the direct refinement on large files:
Example:
inf: open/direct/lines file
while [L: pick inf 1] [
;;do things with L
]
close inf
> help read
USAGE:
READ source /binary /string /direct /no-wait /lines /part size /with
end-of-line /mode args /custom params /skip length
DESCRIPTION:
Reads from a file, url, or port-spec (block or object).
READ is a native value.
ARGUMENTS:
source -- (Type: file url object block)
REFINEMENTS:
/binary -- Preserves contents exactly.
/string -- Translates all line terminators.
/direct -- Opens the port without buffering.
/no-wait -- Returns immediately without waiting if no data.
/lines -- Handles data as lines.
/part -- Reads a specified amount of data.
size -- (Type: number)
/with -- Specifies alternate line termination.
end-of-line -- (Type: char string)
/mode -- Block of above refinements.
args -- (Type: block)
/custom -- Allows special refinements.
params -- (Type: block)
/skip -- Skips a number of bytes.
length -- (Type: number)
HTH
Tim
On Monday 11 August 2008, Brock Kalef wrote: