InterviewSolution
| 1. |
What are streams? |
|
Answer» Streams are a way handling following:
It is the movement of data from one point to another. When a program is supposed to read a FILE consisting of single page(three to four lines), it will be initially read into memory from start to FINISH and then starts processing. If the file is an e-book consisting of 500+ pages , then it takes lot of storage SPACE and TIME to be LOADED into memory, before started processing. This is where Streams make a difference. Using streams, you read it piece by piece , processing its content without keeping it in memory. The following are the advantages of streams
The following code statement refer to stream module const stream = require(‘Stream’); |
|