Node.js Streams: The Complete Guide
Streams are the reason Node.js can handle giant files without running out of memory. Most tutorials explain the theory and skip the parts that actually trip you up. This one doesn't.
7 articles found
Streams are the reason Node.js can handle giant files without running out of memory. Most tutorials explain the theory and skip the parts that actually trip you up. This one doesn't.
I got tired of repeating the same terminal commands, so I built a CLI tool with Node.js over a weekend. Here's how I set up argument parsing, interactive prompts, and published the whole thing to npm.
Our API went down on a Saturday because we were running a single Node process on a single core with no recovery plan. This post walks through what we changed: forking workers with the cluster module, wiring up zero-downtime restarts, managing worker lifecycles, handling sticky sessions, and running it all through PM2 in production.
Buffers tripped me up for a while. They're how Node handles raw binary data outside the V8 heap, and once you actually understand what's happening with Buffer.from() and friends, a lot of Node's I/O behavior starts to make sense. Here's what I wish someone had told me earlier.
Sometimes Node needs to shell out to run ffmpeg, a Python script, or a system command. The child_process module gives you four ways to do it, and each has tradeoffs I had to learn the hard way.
I've been asked about the event loop more than any other Node.js topic. Here's how I finally made sense of it -- why Node can juggle thousands of connections on one thread, and the mistakes I kept making that blocked it.