class ReadableStream

Supported only in the v8 engine. Introduced in Max v9.2.0.

A byte-oriented readable stream. Used for Response.body and as a streamed request body.

Index

Constructors

Methods

new ReadableStream(underlyingSource, strategy)

new ReadableStream(underlyingSource?: any, strategy?: any);

Constructs a new instance of the ReadableStream class

ParameterTypeDescription
optional underlyingSourceanyan object with optional start, pull, and cancel methods.
optional strategyanyan optional queuing strategy.

[Symbol.asyncIterator]()

Async iteration support (for await ... of).

[Symbol.asyncIterator](): AsyncIterableIterator<buffer.IOBuffer>;
NameTypeDescription
Return ValueAsyncIterableIterator<buffer.IOBuffer>

cancel(reason)

Cancels the stream, aborting any underlying transport.

cancel(reason?: any): Promise<void>;
NameTypeDescription
optional reasonany
Return ValuePromise<void>

getReader()

Acquires a reader and locks the stream.

getReader(): ReadableStreamDefaultReader;
NameTypeDescription
Return ValueReadableStreamDefaultReader

pipeThrough(transform)

Pipes this stream through a TransformStream.

pipeThrough(transform: TransformStream): ReadableStream;
NameTypeDescription
transformTransformStream
Return ValueReadableStream

pipeTo(destination)

Pipes this stream to a WritableStream.

pipeTo(destination: WritableStream): Promise<void>;
NameTypeDescription
destinationWritableStream
Return ValuePromise<void>

tee()

Splits the stream into two independent branches.

tee(): [ReadableStream, ReadableStream];
NameTypeDescription
Return Value[ReadableStream, ReadableStream]

values()

Returns an async iterator over the stream's chunks.

values(): AsyncIterableIterator<buffer.IOBuffer>;
NameTypeDescription
Return ValueAsyncIterableIterator<buffer.IOBuffer>