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
- [Symbol.asyncIterator]()
- cancel(reason)
- getReader()
- pipeThrough(transform)
- pipeTo(destination)
- tee()
- values()
new ReadableStream(underlyingSource, strategy)
new ReadableStream(underlyingSource?: any, strategy?: any);
Constructs a new instance of the ReadableStream class
| Parameter | Type | Description |
|---|---|---|
| optional underlyingSource | any | an object with optional start, pull, and cancel methods. |
| optional strategy | any | an optional queuing strategy. |
[Symbol.asyncIterator]()
Async iteration support (for await ... of).
[Symbol.asyncIterator](): AsyncIterableIterator<buffer.IOBuffer>;
| Name | Type | Description |
|---|---|---|
| Return Value | AsyncIterableIterator<buffer.IOBuffer> |
cancel(reason)
Cancels the stream, aborting any underlying transport.
cancel(reason?: any): Promise<void>;
| Name | Type | Description |
|---|---|---|
| optional reason | any | |
| Return Value | Promise<void> |
getReader()
Acquires a reader and locks the stream.
getReader(): ReadableStreamDefaultReader;
| Name | Type | Description |
|---|---|---|
| Return Value | ReadableStreamDefaultReader |
pipeThrough(transform)
Pipes this stream through a TransformStream.
pipeThrough(transform: TransformStream): ReadableStream;
| Name | Type | Description |
|---|---|---|
| transform | TransformStream | |
| Return Value | ReadableStream |
pipeTo(destination)
Pipes this stream to a WritableStream.
pipeTo(destination: WritableStream): Promise<void>;
| Name | Type | Description |
|---|---|---|
| destination | WritableStream | |
| Return Value | Promise<void> |
tee()
Splits the stream into two independent branches.
tee(): [ReadableStream, ReadableStream];
| Name | Type | Description |
|---|---|---|
| Return Value | [ReadableStream, ReadableStream] |
values()
Returns an async iterator over the stream's chunks.
values(): AsyncIterableIterator<buffer.IOBuffer>;
| Name | Type | Description |
|---|---|---|
| Return Value | AsyncIterableIterator<buffer.IOBuffer> |