Options
All
  • Public
  • Public/Protected
  • All
Menu

A BYOB reader vended by a ReadableStream.

Hierarchy

  • ReadableStreamBYOBReader

Index

Constructors

Accessors

Methods

Constructors

constructor

Accessors

closed

  • get closed(): Promise<void>
  • Returns a promise that will be fulfilled when the stream becomes closed, or rejected if the stream ever errors or the reader's lock is released before the stream finishes closing.

    Returns Promise<void>

Methods

cancel

  • cancel(reason?: any): Promise<void>
  • If the reader is active, behaves the same as stream.cancel(reason).

    Parameters

    • Optional reason: any

    Returns Promise<void>

read

  • Attempts to reads bytes into view, and returns a promise resolved with the result.

    If reading a chunk causes the queue to become empty, more data will be pulled from the underlying source.

    Type parameters

    • T: ArrayBufferView

    Parameters

    • view: T

    Returns Promise<ReadableStreamBYOBReadResult<T>>

releaseLock

  • releaseLock(): void
  • Releases the reader's lock on the corresponding stream. After the lock is released, the reader is no longer active. If the associated stream is errored when the lock is released, the reader will appear errored in the same way from now on; otherwise, the reader will appear closed.

    A reader's lock cannot be released while it still has a pending read request, i.e., if a promise returned by the reader's read() method has not yet been settled. Attempting to do so will throw a TypeError and leave the reader locked to the stream.

    Returns void

Generated using TypeDoc