6

Using Node.js Streams

One of the main tasks required in server-side development is transferring data, either reading data sent by a client or browser or writing data that must be transmitted or stored in some way. In this chapter, I will introduce the Node.js API for dealing with data sources and data destinations, known as streams. I will explain the concept behind streams, show how they are used to deal with HTTP requests, and explain why one common source of data – the file system – should be used with caution in a server-side project. Table 6.1 puts streams in context.

Table 6.1: Putting streams in context

Question

Answer

What are they?

Streams are used by Node.js to represent data sources or destinations, including HTTP requests ...

Get Mastering Node.js Web Development 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.