Hour 20. The Stream Module

What You’ll Learn in This Hour:

• What streams are

• Creating a readable stream

• Creating a writable stream

• Piping data between readable and writable streams

A Primer on Streams

In UNIX-type operating systems, streams are a standard concept, and there are three main streams:

• Standard input

• Standard output

• Standard error

Programs can read and write from these streams, and because they are a standard interface, it makes it easy to connect small, discrete programs together. In UNIX-type operating systems, it is possible to redirect these streams, so for example, you can redirect standard input to standard output if you want. It is helpful to understand how data flows between streams, so let’s explore this. Suppose ...

Get Sams Teach Yourself Node.js in 24 Hours 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.