Skip to main content

ReadableStreamDefaultController

The ReadableStreamDefaultController interface of the Streams API represents a controller allowing control of a ReadableStream's state and internal queue. Default controllers are for streams that are not byte streams.

MDN Reference

Type Parameters

Type ParameterDefault type
Rany

Methods

close()

close(): void;

The close() method of the ReadableStreamDefaultController interface closes the associated stream.

MDN Reference

Returns

void


enqueue()

enqueue(chunk): void;

The enqueue() method of the ReadableStreamDefaultController interface enqueues a given chunk in the associated stream.

MDN Reference

Parameters

ParameterType
chunkR

Returns

void


error()

error(e?): void;

The error() method of the ReadableStreamDefaultController interface causes any future interactions with the associated stream to error.

MDN Reference

Parameters

ParameterType
e?any

Returns

void

Properties

desiredSize

readonly desiredSize: number | null;

The desiredSize read-only property of the ReadableStreamDefaultController interface returns the desired size required to fill the stream's internal queue.

MDN Reference