VOOZH about

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

⇱ Node.js Readable Stream readable Event - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Node.js Readable Stream readable Event

Last Updated : 12 Oct, 2021
The 'readable' Event in a Readable Stream is emitted when the data is available so that it can be read from the stream or it can be emitted by adding a listener for the 'readable' event which will cause data to be read into an internal buffer. Syntax:
Event: 'readable'
Below examples illustrate the use of readable event in Node.js: Example 1: Output:
Done...
read: GeeksforGeeks
Example 2: Output:
Done.
readable: GeeksforGeeks
readable: null
Stream ended
Here, end event is emitted so null is returned. Reference: https://nodejs.org/api/stream.html#stream_event_readable
Comment

Explore