From the course: Node.js Essential Training

Unlock the full course today

Join today to access over 24,300 courses taught by industry experts.

Readable file streams

Readable file streams

- [Instructor] Streams in Node.js give us a way to asynchronously handle continuous data flows. Understanding how streams work can dramatically improve the way your application handles large data. Streams are actually something we've already been using, so let's take a look at this ask.js file. Remember, this is where we took our questions and created an empty array of answers, and then we asked our users to type their answers into the chat. So process.standardoutput is what we've been using to write data to the terminal, but standard output is really a writeable stream. We send data chunks to it using the right method. Process.standardinput is a readable stream. Whenever a data event is raised like it is here, we're going to use a callback function and pass some data back into this callback function so that we can use it within the context of that function. So, we've been using streams already because process.standardinput…

Contents