A synchronous readable stream

interface ISyncReadable {
    readSync: (bytes: number) => Uint8Array;
}

Implemented by

Properties

Properties

readSync: (bytes: number) => Uint8Array

Read the specified number of bytes from the source and return them as a Uint8Array.

The returned Uint8Array:

  • may be a view into a larger buffer
  • is only valid until the next call to readSync
  • may be smaller than the requested number of bytes if the end of the source is reached.

these constraints allow for more efficient zero-copy implementations in many cases

Type declaration

    • (bytes: number): Uint8Array
    • Parameters

      • bytes: number

        The number of bytes to read

      Returns Uint8Array

      Uint8Array containing the bytes that were read.