ReadableStream
A ReadableStream
is returned by the readable
property inside TransformStream
.
locked
boolean- A Boolean value that indicates if the readable stream is locked to a reader.
-
pipeTo(destinationWritableStream, optionsPipeToOptions)
: Promise<void>- Pipes the readable stream to a given writable stream
destination
and returns a promise that is fulfilled when thewrite
operation succeeds or rejects it if the operation fails.
- Pipes the readable stream to a given writable stream
-
getReader(optionsObject)
: ReadableStreamDefaultReader- Gets an instance of
ReadableStreamDefaultReader
and locks theReadableStream
to that reader instance. This method accepts an object argument indicating options. The only supported option ismode
, which can be set tobyob
to create aReadableStreamBYOBReader
, as shown here:
- Gets an instance of
-
preventClose
bool- When
true
, closure of the sourceReadableStream
will not cause the destinationWritableStream
to be closed.
- When
-
preventAbort
bool- When
true
, errors in the sourceReadableStream
will no longer abort the destinationWritableStream
.pipeTo
will return a rejected promise with the error from the source or any error that occurred while aborting the destination.
- When
- Streams
- Readable streams in the WHATWG Streams API specification ↗
- MDN’s
ReadableStream
documentation ↗