enqueue()
The stream controller method that adds a chunk to a ReadableStream for readers to consume.
In more detail
A stream you build yourself calls controller.enqueue(chunk) for each piece and controller.close() at the end. More generally, to enqueue is to add something to the back of a queue.
Related terms
- ReadableStream — A browser object that delivers data in chunks as it arrives, such as a fetch response.body, instead of all at once at the end.
- chunk — One piece of a larger piece of data delivered by a stream.
Taught in
- The Browser Event Loop: Call Stack, Microtasks And Macrotasks — Frontend Architecture & Web Platform
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform