Skip to main content

ReadableStreamBYOBReader

The ReadableStreamBYOBReader interface of the Streams API defines a reader for a ReadableStream that supports zero-copy reading from an underlying byte source. It is used for efficient copying from underlying sources where the data is delivered as an "anonymous" sequence of bytes, such as files.

MDN Reference

Extends

Methods

cancel()

cancel(reason?): Promise<void>;

MDN Reference

Parameters

ParameterType
reason?any

Returns

Promise<void>

Inherited from

ReadableStreamGenericReader.cancel


read()

read<T>(view, options?): Promise<ReadableStreamReadResult<T>>;

The read() method of the ReadableStreamBYOBReader interface is used to read data into a view on a user-supplied buffer from an associated readable byte stream. A request for data will be satisfied from the stream's internal queues if there is any data present. If the stream queues are empty, the request may be supplied as a zero-copy transfer from the underlying byte source.

MDN Reference

Type Parameters

Type Parameter
T extends ArrayBufferView<ArrayBuffer>

Parameters

ParameterType
viewT
options?ReadableStreamBYOBReaderReadOptions

Returns

Promise<ReadableStreamReadResult<T>>


releaseLock()

releaseLock(): void;

The releaseLock() method of the ReadableStreamBYOBReader interface releases the reader's lock on the stream. After the lock is released, the reader is no longer active.

MDN Reference

Returns

void

Properties

closed

readonly closed: Promise<void>;

MDN Reference

Inherited from

ReadableStreamGenericReader.closed