Chapter 5. Streams: Node’s most powerful and misunderstood feature

This chapter covers

  • What streams are and how to use them
  • How to use Node’s built-in streaming APIs
  • The stream API used in Node 0.8 and below
  • The stream primitive classes bundled since Node 0.10
  • Strategies for testing streams

Streams are an event-based API for managing and modeling data, and are wonderfully efficient. By leveraging EventEmitter and Node’s non-blocking I/O libraries, the stream module allows data to be dynamically processed when it’s available, and then released when it’s no longer needed.

The idea of a stream of data isn’t new, but it’s an important concept and integral to Node. After chapter 4, mastering streams is the next step on the path to becoming ...

Get Node.js in Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.