O'Reilly logo

Node.js in Practice by Alex Young and Marc Harter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required