All languages

JavaScript

You're viewing a free preview. Sign in free to read every script.

Why this exists A log file, a database dump, an uploaded archive or a backup can be far larger than the memory you want to spend. fs.readFile loads all of it, so a 2 GB file needs 2 GB of RAM, and the service is killed…

Node.js Streams and Buffers: Backpressure, Transform, pipeline, gzip and the Multi-Byte Trap

Process data bigger than memory: chunks and backpressure, writing 50,000 lines safely, a Transform that filters lines across chunk boundaries, pipeline with gzip and automatic cleanup on failure, and Buffers as raw bytes (encodings, binary fields, shared slices, and StringDecoder for split characters).

Sign in free to read this script, along with the rest of the library.

Sign in free