ReadableStream
object cannot be constructed directly. You can use TransformStream to construct a ReadableStream
object.// Use TransformStream to construct a ReadableStream object.const { readable } = new TransformStream();
// readable.lockedreadonly locked: boolean;
reader
. Before the reader
calls the releaseLock()
method, the stream is locked. readable.getReader(options?: ReaderOptions): ReadableStreamDefaultReader | ReadableStreamBYOBReader;
reader
and locks the current stream until the reader
calls the releaseLock()
method.Parameter | Type | Required | Description |
options | Yes | The configuration items for generating the reader. |
ReaderOptions
object.Parameter | Type | Required | Description |
mode | string | No | Reader The type of the `reader`. Default value: undefined. Valid values:undefined byob |
readable.pipeThrough(transformStream: TransformStream, options?: PipeToOptions): ReadableStream;
transformStream
and returns the readable side of the transformStream
.writable
side of the current stream is locked.Parameter | Type | Required | Description |
transformStream | Yes | The destination to which the current stream is piped. | |
options | Yes | The configuration items for piping the stream. |
Parameter | Type | Required | Description |
preventClose | boolean | No | If the value is true, the writable stream is not closed along with the readable stream. |
preventAbort | boolean | No | If the value is true, the writable stream is not stopped when an exception occurs on the readable stream. |
preventCancel | boolean | No | If the value is true, the writable stream is not closed when the readable stream is incorrect. |
signal | No | If `signal` is stopped, ongoing pipe operations are stopped. |
readable.pipeTo(destination: WritableStream, options?: PipeToOptions): Promise<void>;
destination
writable stream.destination
of the current stream is locked.Parameter | Type | Required | Description |
destination | Yes | The writable stream. | |
options | Yes | The configuration items for piping the stream. |
readable.tee(): [ReadableStream, ReadableStream];
readable.cancel(reason?: string): Promise<string>;
Was this page helpful?