| Node.js Chaining Streams
Node.js Chaining Stream
When we say about the Node.js Chaining Streams, it is a mechanism of creating a chain of multiple stream operations and this can be done by connecting output of one steam to another stream. It is generally used with piping operation.
To understand this we will take an example of piping and chaining to compress a file and then we can decompress the same file.
File: main.js
Now open command prompt to run Node.js command and then run main.js
node main.js
Now you will get the output of main.js file
Now once you see the file "input.txt" and the is compresses and a new file is created which name is "input.txt.gz" in the current file.
And to decompress the same file we will create a new file with name "main.js"'
File: main.js
Now you need to open Node.js command prompt and run the below command.
node main.js
And output of above command is given below.
| | |