What are streams, buffers and EventEmitter?
Practice this questionWANT TO UNDERSTAND THE CONCEPT FIRST?Learn What are streams, buffers and EventEmitter?
Definition:
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.
Key points:
-
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.
Interview point:
- An EventEmitter notification is in-process and normally synchronous; it is not a durable background queue.
Adapted from 01_JAVASCRIPT_TYPESCRIPT.md · “What are streams, buffers and EventEmitter?”. Code examples are study fragments. Difficulty and core labels are editorial estimates; version-specific behavior should be checked against your project.