May 31, 2020 in Node.Js
Q:

What is Streams in Node.js?

1 Answer

0 votes
May 31, 2020

Streams are pipes that let you easily read data from a source and pipe it to a destination. Simply put, a stream is nothing but an EventEmitter and implements some specials methods. Depending on the methods implemented, a stream becomes Readable, Writable, or Duplex (both readable and writable).

For example, if we want to read data from a file, the best way to do it from a stream is to listen to data event and attach a callback. When a chunk of data is available, the readable stream emits a data event and your callback executes. Take a look at the following snippet:

Click here to read more about Loan/Mortgage
Click here to read more about Insurance

Related questions

0 votes
May 31, 2020 in Node.Js
+1 vote
May 31, 2020 in Node.Js
...