• Public
  • Public/Protected
  • All






  • Reads up to p.byteLength bytes into p. It resolves to the number of bytes read (0 <= n <= p.byteLength) and any error encountered. Even if read() returns n < p.byteLength, it may use all of p as scratch space during the call. If some data is available but not p.byteLength bytes, read() conventionally returns what is available instead of waiting for more.

    When read() encounters an error or end-of-file condition after successfully reading n > 0 bytes, it returns the number of bytes read. It may return the (non-nil) error from the same call or return the error (and n == 0) from a subsequent call. An instance of this general case is that a Reader returning a non-zero number of bytes at the end of the input stream may return either err == EOF or err == null. The next read() should return 0, EOF.

    Callers should always process the n > 0 bytes returned before considering the EOF. Doing so correctly handles I/O errors that happen after reading some bytes and also both of the allowed EOF behaviors.

    Implementations of read() are discouraged from returning a zero byte count with a null error, except when p.byteLength == 0. Callers should treat a return of 0 and null as indicating that nothing happened; in particular it does not indicate EOF.

    Implementations must not retain p.


    • p: Uint8Array

    Returns Promise<ReadResult>


  • seek(offset: number, whence: SeekMode): Promise<void>
  • Seek sets the offset for the next read() or write() to offset, interpreted according to whence: SeekStart means relative to the start of the file, SeekCurrent means relative to the current offset, and SeekEnd means relative to the end. Seek returns the new offset relative to the start of the file and an error, if any.

    Seeking to an offset before the start of the file is an error. Seeking to any positive offset is legal, but the behavior of subsequent I/O operations on the underlying object is implementation-dependent.


    Returns Promise<void>


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc