Course map
Stage 1: App Router Foundations
Stage 2: The Rendering Model
Stage 3: Data, Caching and Mutations
Stage 4: Full-Stack Next.js
Stage 5: Production and Specialization

Part 07 / Topic 6 of 7

Observing streaming for real — and why curl alone can mislead you

The installed package's own guide says it plainly: "Command-line tools like curl also buffer by default... curl still relies on newline characters to flush lines to the terminal. A stream that sends chunks without newlines may appear to stall even with -N." Confirmed directly against this course's harness — the /ops response contains exactly one newline character in its entire body:

$ curl -s http://localhost:PORT/ops | python3 -c "import sys; print(sys.stdin.read().count(chr(10)))"
1

With only one newline in a multi-second response, curl -N (no-buffer) still can't show you anything progressively — there is nothing to flush a line on. examples/05-stream-observer.mjs sidesteps this entirely by reading the response as a raw byte stream and timestamping each read(), which is what produced every timing number in sections 2 and 4. Accept-Encoding: identity in that script matters too — compression can itself buffer chunks before flushing, the same guide notes, so the script asks the server not to compress at all.

Done here? The practice set for Part 7 — including the solutions — is on the part page.

Search the guide