Interface ReaderSync
Implemented by
Index
Methods
Methods
readSync
- read
Sync (p): 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()returnsn<p.byteLength, it may use all ofpas scratch space during the call. If some data is available but notp.byteLengthbytes,read()conventionally returns what is available instead of waiting for more.When
readSync()encounters end-of-file condition, it returns EOF (null).When
readSync()encounters an error, it throws 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=toIteratorSync to turn a
ReaderSyncinto an IterableIterator.Parameters
- p: Uint8Array
Returns null | number
An abstract interface which when implemented provides an interface to read bytes into an array buffer synchronously.