• read exactly N bytes from the source

    Parameters

    • readable: IReadable

      fuman readable stream

    • length: number | Uint8Array

      length of the buffer to read, or a buffer to read into (when a number is passed, a new buffer will be allocated)

    • onEof: "error" | "truncate" = 'error'

      what to do when the end of the stream is reached

      • error - throw an PartialReadError
      • truncate - truncate the buffer to the number of bytes that were read. note that this might return 0 bytes

    Returns Promise<Uint8Array>