Options
All
  • Public
  • Public/Protected
  • All
Menu

Class ReadableStreamDefaultReader<R>

A default reader vended by a ReadableStream.

Type parameters

  • R = any

Hierarchy

  • ReadableStreamDefaultReader

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

  • Returns a promise that allows access to the next chunk from the stream's internal queue, if available.

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

    Returns Promise<ReadableStreamDefaultReadResult<R>>

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