VOOZH about

URL: https://www.geeksforgeeks.org/node-js/node-js-readable-stream-end-event/

⇱ Node.js Readable Stream end Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js Readable Stream end Event

Last Updated : 12 Oct, 2021
The 'end' Event in a Readable Stream is emitted when there is no available data to be consumed from the readable stream. And the 'end' event won't be emitted if the data is not fully consumed. It can be done by switching the stream into the flowing mode, or by calling stream.read() method again and again until all the data is being consumed. Syntax:
Event: 'end'
Below examples illustrate the use of end event in Node.js: Example 1: Output:
Done...
read: GeeksforGeeks
All the data is being consumed.
Example 2: Output:
Done...
Here, all the data is not consumed as stream.read() method is not called so the end event is not emitted here. Reference: https://nodejs.org/api/stream.html#stream_event_end
Comment

Explore