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.
In more detail
Call getReader() and loop on await reader.read() until done is true, handling each chunk as it comes. Streaming shows the first content sooner and never needs the whole response in memory.
Related terms
- streaming — Sending a response in pieces as they become available instead of building the whole thing first.
- chunk — One piece of a larger piece of data delivered by a stream.
- TextDecoderStream — A stream transformer that turns incoming bytes into text using a character encoding such as UTF-8, even when a character is split across chunks.
- Fetch API — The standard JavaScript function fetch() for making HTTP requests, built into browsers and current server runtimes, which returns a promise for the response.
- Server-Sent Events — A standard way for a server to keep an HTTP response open and push a stream of text events to the client, in one direction only.
- newline-delimited JSON — A streaming format in which every line is one complete JSON document, so each record can be parsed as soon as it arrives.
- Route Handlers — Files in a Next.js app, named route.ts, that answer HTTP requests for a path with functions named after methods such as GET and POST.
Taught in
- The Fetch API: Streaming Responses, HTTP Caching And Keepalive — Frontend Architecture & Web Platform
- Streaming Endpoints: Server-Sent Events & NDJSON Feeds — Next.js 15 & Modern App Router Architecture
- Runtime Environments: Node.js vs Edge Runtime Choice — Next.js 15 & Modern App Router Architecture