http-networkingAnswer last reviewed July 2026

How does a request body actually arrive in Node, and how would you accept a really large upload without the process falling over?

A strong answer knows how a request body gets framed on the wire and streamed into Node, and why holding whole bodies in memory will eventually hurt.

What an AI-prepared candidate might say

So in Node the request object is a readable stream, the body comes in as data events unless you've got a body parser in front. With Express you add express.json() or express.urlencoded() and then you just read req.body. With raw http you listen for the data chunks, concatenate them, and handle the full body on end. The client says how big the body is with the Content-Length header, or it uses chunked transfer encoding when it doesn't know the size ahead of time. For big uploads you're supposed to stream instead of buffering everything in memory, so pipe the request to a file or a storage service rather than building one giant Buffer. And you want a size limit so a client can't send an unbounded body and exhaust memory. Most parsers let you configure a max body size, Express defaults to a 100KB limit for JSON I believe.

Senior
Locked

How the body gets framed, Content-Length versus chunked, how req hands it to you as a readable stream, and where the parser passes off backpressure.

Unlock the depth
Staff
Locked

Streaming an upload straight into storage with the size cap enforced mid-read, plus the metrics that spot a memory blowup before it OOMs the process.

Unlock the depth
Follow-up chain
How does a request body actually arrive in Node, and how would you accept a really large upload without the process falling over? | NodeBook