ServerJS/API/file: Difference between revisions

Jump to navigation Jump to search
m
Fixes pointed out by tlrobinson.
mNo edit summary
m (Fixes pointed out by tlrobinson.)
Line 79: Line 79:
* BinaryReadStream
* BinaryReadStream
** read() -> all:ByteString
** read() -> all:ByteString
** read(max:Number) -> actual:Number
** read(max:Number) -> actual:ByteString
** readInto(buffer:Array|ByteArray, [begin:Number, [end:Number]]) -> actual:Number
** readInto(buffer:Array|ByteArray, [begin:Number, [end:Number]]) -> actual:Number
** available() -> Number -- how many bytes are ready to be read (buffered) without blocking.
** available() -> Number -- how many bytes are ready to be read (buffered) without blocking.
Line 90: Line 90:
** tell() -> position:Number)
** tell() -> position:Number)
** seek(position:Number, whence:enumerated)
** seek(position:Number, whence:enumerated)
** rewind() -- returns the read/write head to the beginning of the file
** truncate([size:Number]) -- sets the length of the file.  size defaults to the current position as reported by tell().  If a size is explicated, truncate also seeks to the new end.
* TextReadStream
* TextReadStream
** raw -> a BinaryReadStream
** raw -> a BinaryReadStream
** read() -> String -- returns all remaining characters
** read(max:Number) -> String -- returns up to max characters, with the length of the returned string reflecting the actual number read.
** readLine() -> String -- returns "" if no data is available before EOF.  Otherwise, includes the "recordSeparator".
** readLine() -> String -- returns "" if no data is available before EOF.  Otherwise, includes the "recordSeparator".
** readLines() -> Array * String
** readLines() -> Array * String
171

edits

Navigation menu