JavaScripture
Contribute via GitHub Feedback

ReadableStream : Object

Represents a readable stream of data. The stream can be read using the ReadableStreamReader or by piping to a WritableStream.

Constructors

new ReadableStream(source : ReadableStreamSource, [strategy : QueuingStrategy]) : ReadableStream

Instance Properties

locked : Boolean  

Instance Methods

cancel([reason : Object]) : Promise<undefined>
getReader([options : Object]) : ReadableStreamDefaultReader
options : {
mode :StringEither undefined or 'byob'
}

Example:

Run

Results:

 

pipeThrough(transform : Object, [options : Object]) : ReadableStream
transform : {
readable :ReadableStream
writable :WritableStream
}
options : {
signal :AbortSignal
preventAbort :Boolean
preventCancel :Boolean
preventClose :Boolean
}

Allows transforming the stream of data. Each chunk is passed to transform.writable. Returns transform.readable. See TransformStream for a convienient way to make the transform parameter.

Example:

Run

Results:

 

pipeTo(destination : WritableStream, [options : Object]) : Promise<undefined>
options : {
signal :AbortSignal
preventAbort :Boolean
preventCancel :Boolean
preventClose :Boolean
}

Passes each chunk to the WritableStream.

Example:

Run

Results: