streams-backpressureAnswer last reviewed July 2026

So fetch gives you a web ReadableStream, but your storage SDK wants a Node stream. What's actually different between the two models, and how do you bridge them without breaking anything?

A strong answer knows how flow control works in both stream models, plus the toWeb/fromWeb bridges and their error and cancellation caveats

What an AI-prepared candidate might say

Node ships two stream families, so there's the classic Node streams, Readable, Writable, events, pipe, and then the WHATWG web streams, ReadableStream, WritableStream, TransformStream, which came over from the browser standard. A fetch body is a web stream. The main difference is style, I think. Node streams are event-based and push-oriented, web streams are promise-based and pull-oriented, with readers and controllers instead of events. For interop Node gives you official converters, Readable.toWeb() and Readable.fromWeb(), and the same methods exist on Writable and Duplex. So for the fetch-to-SDK case you'd write Readable.fromWeb(response.body) and then pipe or pipeline into the SDK's stream like normal. Backpressure works across the conversion, from what I understand. Web streams are the more portable choice since they run in browsers, edge runtimes, and Node alike, and Node streams stay the native fit for Node's own APIs like fs and http.

Senior
Locked

The pull-based controller model, desiredSize, queuing strategies, locked readers, laid alongside Node's event machinery, and what the official bridges map where.

Unlock the depth
Staff
Locked

The convert-at-the-edges rule for your architecture, how errors and cancellation behave across the bridge, and the per-chunk overhead question you benchmark before any migration.

Unlock the depth
Follow-up chain
So fetch gives you a web ReadableStream, but your storage SDK wants a Node stream. What's actually different between the two models, and how do you bridge them without breaking anything? | NodeBook