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
read() resolves to
p.byteLength, it may
use all of
p as scratch space during the call. If some data is
available but not
read() conventionally resolves
to what is available instead of waiting for more.
read() encounters end-of-file condition, it resolves to EOF
read() encounters an error, it rejects 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
Implementations should not retain a reference to
itereateReader from from https://deno.land/std/streams/conversion.ts to
turn a Reader into an AsyncIterator.