ReadableStream
This Streams API interface represents a readable stream of byte data. The Fetch API offers a concrete instance of a ReadableStream through the body property of a Response object.
Type Parameters
Type Parameter | Default type |
---|---|
R | any |
Implements
Constructors
new ReadableStream()
new ReadableStream<R
>(underlyingSource
, strategy
?): ReadableStream
<R
>
Parameters
Parameter | Type |
---|---|
underlyingSource | UnderlyingByteSource |
strategy ? | object |
strategy.highWaterMark ? | number |
Returns
new ReadableStream()
new ReadableStream<R
>(underlyingSource
, strategy
?): ReadableStream
<R
>
Parameters
Parameter | Type |
---|---|
underlyingSource | UnderlyingDefaultSource <R > |
strategy ? | QueuingStrategy <R > |
Returns
new ReadableStream()
new ReadableStream<R
>(underlyingSource
?, strategy
?): ReadableStream
<R
>
Parameters
Parameter | Type |
---|---|
underlyingSource ? | UnderlyingSource <R > |
strategy ? | QueuingStrategy <R > |
Returns
Properties
Property | Modifier | Type | Description |
---|---|---|---|
locked | readonly | boolean | MDN Reference |
Methods
[asyncIterator]()
[asyncIterator](options
?): ReadableStreamAsyncIterator
<R
>
Parameters
Parameter | Type |
---|---|
options ? | ReadableStreamIteratorOptions |
Returns
ReadableStreamAsyncIterator
<R
>
Implementation of
globalThis.ReadableStream.[asyncIterator]
cancel()
cancel(reason
?): Promise
<void
>
Parameters
Parameter | Type |
---|---|
reason ? | any |
Returns
Promise
<void
>
Implementation of
globalThis.ReadableStream.cancel
getReader()
getReader(options)
getReader(options
): ReadableStreamBYOBReader
Parameters
Parameter | Type |
---|---|
options | object |
options.mode | "byob" |
Returns
Implementation of
globalThis.ReadableStream.getReader
getReader()
getReader(): ReadableStreamDefaultReader
<R
>
Returns
ReadableStreamDefaultReader
<R
>
Implementation of
globalThis.ReadableStream.getReader
getReader(options)
getReader(options
?): ReadableStreamReader
<R
>
Parameters
Parameter | Type |
---|---|
options ? | ReadableStreamGetReaderOptions |
Returns
Implementation of
globalThis.ReadableStream.getReader
pipeThrough()
pipeThrough<T
>(transform
, options
?): ReadableStream
<T
>
Type Parameters
Type Parameter |
---|
T |
Parameters
Parameter | Type |
---|---|
transform | ReadableWritablePair <T , R > |
options ? | StreamPipeOptions |
Returns
Implementation of
globalThis.ReadableStream.pipeThrough
pipeTo()
pipeTo(destination
, options
?): Promise
<void
>
Parameters
Parameter | Type |
---|---|
destination | WritableStream <R > |
options ? | StreamPipeOptions |
Returns
Promise
<void
>
Implementation of
globalThis.ReadableStream.pipeTo
tee()
tee(): [ReadableStream
<R
>, ReadableStream
<R
>]
Returns
[ReadableStream
<R
>, ReadableStream
<R
>]
Implementation of
globalThis.ReadableStream.tee
values()
values(options
?): ReadableStreamAsyncIterator
<any
>
Parameters
Parameter | Type |
---|---|
options ? | ReadableStreamIteratorOptions |
Returns
ReadableStreamAsyncIterator
<any
>
Implementation of
globalThis.ReadableStream.values