Universal I/O.
For a decade, Node.js text handling and HTTP requests were proprietary (http.request, fs.createReadStream).
Now, Node.js implements the Web Standards. Code you write for the browser runs on the server.
02. ReadableStream vs Class Stream
Node.js streams (.pipe()) are legendary but complex.
Web Streams (.pipeTo(), .pipeThrough()) are the modern standard, used by fetch and supported by Edge runtimes (Cloudflare, Deno).
Deep Dive: Duplex Streams
Since Node.js 20, Duplex.from() and Readable.fromWeb() allow you to convert between Node.js Streams and Web Streams instantly.
This means you can pipe a native Node fs.createReadStream into a Web Standard fetch body effortlessly.
await response.body
.pipeThrough(new DecompressionStream('gzip'))
.pipeTo(Writable.toWeb(fs.createWriteStream('./out.txt')));
04. The Senior Engineer's Take
Interoperability is king.
By adopting Web Streams, you make your code portable. The same utility function that processes CSVs on your Node.js backend can now handle file uploads in the user's browser, sharing the exact same logic.