Interface Reader
Implemented by
Index
Methods
Methods
read
- read(p): Promise<null | number>
Reads up to
p.byteLengthbytes intop. It resolves to the number of bytes read (0<n<=p.byteLength) and rejects if any error encountered. Even ifread()resolves ton<p.byteLength, it may use all ofpas scratch space during the call. If some data is available but notp.byteLengthbytes,read()conventionally resolves to what is available instead of waiting for more.When
read()encounters end-of-file condition, it resolves to EOF (null).When
read()encounters an error, it rejects with an error.Callers should always process the
n>0bytes 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
p.Use @std/io/to-iterator.ts?s=toIterator to turn a
Readerinto an AsyncIterableIterator.Parameters
- p: Uint8Array
Returns Promise<null | number>
An abstract interface which when implemented provides an interface to read bytes into an array buffer asynchronously.