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.


API documentation sourced from MDN Web Docs.

on
Implemented types
Available extensions

Constructors

ReadableStreamDefaultReader(ReadableStream stream)
factory

Properties

closed JSPromise<JSAny?>
The closed read-only property of the ReadableStreamDefaultReader interface returns a Promise that fulfills when the stream closes, or rejects if the stream throws an error or the reader's lock is released. This property enables you to write code that responds to an end to the streaming process.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

cancel([JSAny? reason]) JSPromise<JSAny?>
The cancel() method of the ReadableStreamDefaultReader interface returns a Promise 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 a Promise 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