Streams are about facilitating efficient, low memory data transfer, and processing; not just to and from the filesystem, but also to other processes and across network sockets.
In this recipe, we're going to write some simple command-line stream apps, then mix and match them with the common stream processing apps written in other languages.
Let's create two files:
uppercaser.js. Both of these need to be executable files as we're going to run them directly as command-line apps:
touch text_stream.js && chmod +x text_stream.js touch uppercaser.js && chmod + x uppercaser.js
Let's start by making a readable stream that randomly pushes lowercase alphabetical letters to its reader ...