Returns an async iterator over the composed stream.
Uses preventCancel: true so early break from for await...of does not
close the stream and block later pushes.
Because values are discarded after being read, only a single consumer is supported. Additional consumers will receive a stream lock error. Unread values will be preserved until close is called.
Ends the stream.
Marks the iterator closed so future push calls are ignored. Buffered values are still yielded before iteration completes.
Causes any future interactions with the associated stream to error with error. Calling this will also clear the pending values immediately, so iterators that were listening will not receive them.
The error to throw from the stream.
An async iterable queue that bridges push-based producers and pull-based consumers.
Composes an internal ReadableStream instead of extending it, so producers call push while consumers use standard async iteration (
for await...of).Symbol.asyncIterator returns
stream.values({ preventCancel: true })so breaking out offor await...ofdoes not cancel the underlying stream. That matters for long-lived sessions where the producer keeps pushing after a consumer stops reading early (for example, test helpers that only collect a fixed count).