This feature is well established and works across many devices and browser versions. It’s been available across browsers since June 2022.
Note: This feature is available in Web Workers.
The enqueue() method of the TransformStreamDefaultController interface enqueues the given chunk in the readable side of the stream.
For more information on readable streams and chunks see Using Readable Streams.
enqueue(chunk)
chunkThe chunk being queued. A chunk is a single piece of data. It can be any type of data, and a stream can contain chunks of different types.
None (undefined).
TypeErrorThe stream is not readable. This might occur if the stream is errored via controller.error(), or when it is closed without its controller's controller.close() method ever being called.
In this example an encoded chunk is passed to the queue using the enqueue() method.
const textEncoderStream = new TransformStream({
transform(chunk, controller) {
controller.enqueue(new TextEncoder().encode(chunk));
},
flush(controller) {
controller.terminate();
},
});
| Specification |
|---|
| Streams> # ts-default-controller-enqueue> |
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
enqueue |
67 | 79 | 102 | 54 | 14.1 | 67 | 102 | 48 | 14.5 | 9.0 | 67 | 14.5 |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/TransformStreamDefaultController/enqueue