Skip to content
Learn Netverks

Lesson

Step 17/36 47% through track

streams-intro

Streams introduction

Last reviewed May 28, 2026 Content v20260528
Track mode
nodejs_server
Means
Node sandbox
Reading
~1 min
Level
intermediate

This lesson

An orientation to the Node.js track—how the server playground works, core vocabulary, and what you will practice next.

You need a clear map of the Node.js track so the event loop, modules, and server runtime do not feel like magic.

You will apply Streams introduction in contexts like: File transforms, upload pipelines, and log processing without loading entire files into RAM.

Run JavaScript on the Node runner when configured—never mix arbitrary shell commands in lessons. Also read the interview prep blocks.

After HTML fundamentals and basic programming concepts—before or alongside SQL.

Streams process data in chunks instead of loading entire files into memory—essential for large uploads, logs, and proxying HTTP responses.

Stream types

  • Readable — source (file read, HTTP response body)
  • Writable — sink (file write, HTTP response)
  • Transform — modify data in flight (gzip, CSV parser)
  • Duplex — both directions (TCP socket)

Pipeline

import { pipeline } from 'node:stream/promises';
import { createReadStream, createWriteStream } from 'node:fs';

await pipeline(
  createReadStream('big.log'),
  createWriteStream('copy.log')
);

Important interview questions and answers

  1. Q: Why streams for large files?
    A: Constant memory usage—process chunk by chunk instead of buffering gigabytes in RAM.
  2. Q: backpressure?
    A: When writable cannot keep up, readable pauses—streams coordinate flow automatically when piped correctly.

Self-check

  1. Name two stream types.
  2. When prefer pipeline over readFile?

Interview tip Lesson completion confidence

Can you explain this lesson in 30 seconds without reading notes?

Not saved yet.

Playground

Runs on the configured server runner (dev: npm run runner with LEARNING_RUNNER_ENABLED=true). Output appears below the editor.

Check yourself

Multiple choice — immediate feedback.

Discussion

Past discussion is visible to everyone. Only logged-in users can post comments and replies.

Starter discussion topics

  • Readable vs Writable?
  • Backpressure idea?

Sign up or log in to post comments and sync lesson progress across devices.

No discussion yet. Be the first to ask a question.

Jump