Skip to main content
D
Node.js
Node.js Streams

Node.js Streams

Node.js streams process large amounts of data in small chunks.

Read Time
5 min read
Difficulty
Beginner
Last Updated
Jun 15, 2026
Version
v1.0.0

Introduction

Streams allow Node.js to read or write data piece by piece instead of loading an entire massive file into memory all at once. This is exactly how video streaming services like Netflix send movies to your browser without crashing your computer.

Example

Example
1/* this reads a stream */
2var fs = require('fs');
3var readerStream = fs.createReadStream('large_video.mp4');
4
5readerStream.on('data', function(chunk) {
6   console.log("Received a chunk of data");
7});

Key Points

  • Readable streams let you read data.
  • Writable streams let you write data.
  • Duplex streams let you read and write simultaneously.
  • Streams prevent memory overloads on the server.

Up Next

Continue your journey with the next topic.

Go to Express Intro