Skip to main content
Version: 3.27.2

desiredSize

The desiredSize read-only property of theReadableByteStreamController interface returns the number of bytes required to fill the stream's internal queue to its "desired size".

The value is used by the stream to indicate a preferred flow rate to the underlying source. Sources that support throttling or pausing their inflow of data (not all do!) should control the inflow such that desiredSize of the stream buffer is kept positive and as close to zero as possible.

The desiredSize is used to apply backpressure from downstream consumers.

Value

An integer. Note that this can be negative if the queue is over-full.

The value will be null if the stream has errored and 0 if it is closed.