LESSON 21 / 22·2 min readIntermediate

What are streams, buffers and EventEmitter?

Try code in the playground
01 Understand02 Recall03 Prepare

Understand the concept

A buffer is a container for raw bytes, while a stream processes a sequence of data in chunks. EventEmitter is a mechanism for registering listeners and notifying them when an event occurs. These tools work together in Node networking and file handling, where data can arrive gradually.

Important ideas

  • A buffer stores bytes; a stream moves data in chunks.

  • Streams help process large files without loading everything at once.

  • EventEmitter calls registered listeners synchronously when an event is emitted.

  • Streams include readable, writable, duplex and transform types.

  • Backpressure keeps a fast producer from overwhelming a slow consumer; simply using chunks does not remove the need to control flow.

PAUSE & RECALL

Can you explain it without the notes?

What are streams, buffers and EventEmitter?

Use your own words. Explain an example and one limitation before checking the explanation.

Check your explanation

A buffer is a container for raw bytes, while a stream processes a sequence of data in chunks. EventEmitter is a mechanism for registering listeners and notifying them when an event occurs. These tools work together in Node networking and file handling, where data can arrive gradually.

CONNECT IT TO YOUR INTERVIEW

Turn this concept into a clear answer.

  • An EventEmitter notification is in-process and normally synchronous; it is not a durable background queue.
Practice this concept
YOUR NEXT STEP

Keep connecting the ideas.

Next lesson: How do garbage collection and memory leaks work?

Adapted from 01_JAVASCRIPT_TYPESCRIPT.md · “What are streams, buffers and EventEmitter?”. Examples are study fragments; framework behavior can depend on your version.