Skip to content
Justice Tech School

Streams

Streams process data in chunks. Readable, Writable and Transform are the types.

Example
const { Readable } = require("stream");
const r = Readable.from(["a", "b", "c"]);
let out = "";
r.on("data", (c) => (out += c));
r.on("end", () => console.log("done:", out));

Result

done: abc

Exercise

Chunk event.

r.on("", fn)

Quiz Test

Why use streams?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.