JavaScripture
Contribute via GitHub Feedback

ReadableStreamSource : Object

Object that provides the sequence of values for a ReadableStream. Passed to the ReadableStream constructor. Any JavaScript object can be used as a readable stream source. Any of the properties/method can be specified. If a property/method is not provided, the ReadableStream will use a default behavior for the property/method.

Instance Properties

type : String

If set to 'bytes', the ReadableStream will be a readable byte stream.

Instance Methods

cancel(reason : Object) : Promise<undefined>

Called when the stream has been canceled, either by ReadableStream.cancel() or Reader.cancel(), with reason as the value passed to that function.

Example:

Run

Results:

 

pull(controller : ReadableStreamController) : Promise<undefined>

Called each time the stream's internal queue drops below the high water mark, indicating this should enqueue more chunks.

Example:

Run

Results:

 

start(controller : ReadableStreamController) : Object

Example:

Run

Results: