Reads up to
p.byteLength bytes into
p. It resolves to the number
of bytes read (
p.byteLength) and rejects if any error
encountered. Even if
p.byteLength, it may use
p as scratch space during the call. If some data is available
read() conventionally returns what is
available instead of waiting for more.
readSync() encounters end-of-file condition, it returns EOF
readSync() encounters an error, it throws with an error.
Callers should always process the
0 bytes returned before
considering the EOF (
null). Doing so correctly handles I/O errors that happen
after reading some bytes and also both of the allowed EOF behaviors.
Implementations should not retain a reference to
Use Deno.iterSync() to turn a ReaderSync into an Iterator.