What Is a Node.js Stream?

Streams are a built-in Node.js language feature that represent an asynchronous flow of data, and are a way to handle reading/writing files. They’re meant to be like Unix pipes, allowing us to hook up a data source one end, any number of consumers on the other end, and pass data between them. Node streams can help you process a file that’s larger than your free memory space because, instead of a program reading a file into memory all at once, it processes data into smaller chunks.

By the end of this tutorial, you should be able to:

  • Learn what is a Node.js stream
  • Understand the limitations of reading an entire file into memory
  • Know what are the benefits of, and use cases for, Node streams
  • Understand some of the events streams emit
  • Learn what pipe does in Node, and how to connect streams using pipe
  • Use the fs module to create Node streams from files
  • Know how to handle stream errors in Node
Log in or Sign up to view the complete tutorial.

Sign in with your Osio Labs account
to gain instant access to our entire library.

Data Brokering with Node.js