ReadableStreamDefaultReader extension type
The ReadableStreamDefaultReader
interface of the
Streams API
represents a default reader that can be used to read stream data supplied
from a network (such as a fetch request).
A ReadableStreamDefaultReader
can be used to read from a ReadableStream
that has an underlying source of any type (unlike a
ReadableStreamBYOBReader, which can only be used with readable streams
that have an underlying byte source).
Note however that zero-copy transfer from an underlying source is only
supported for underlying byte sources that autoallocate buffers.
In other words, the stream must have been
constructed
specifying both
type="bytes"
and
autoAllocateChunkSize
.
For any other underlying source, the stream will always satisfy read
requests with data from internal queues.
Constructors
- ReadableStreamDefaultReader(ReadableStream stream)
-
factory
Properties
Methods
-
cancel(
[JSAny? reason]) → JSPromise< JSAny?> -
The
cancel()
method of the ReadableStreamDefaultReader interface returns aPromise
that resolves when the stream is canceled. Calling this method signals a loss of interest in the stream by a consumer. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
read(
) → JSPromise< ReadableStreamReadResult> -
The
read()
method of the ReadableStreamDefaultReader interface returns aPromise
providing access to the next chunk in the stream's internal queue. -
releaseLock(
) → void -
The
releaseLock()
method of the ReadableStreamDefaultReader interface releases the reader's lock on the stream. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited