Node.js | Writable Stream finish Event
The ‘finish’ event in a Writable Stream is emitted after the Calling of writable.end() method when all the data is being flushed to the hidden system.
Return Value: If the writable.end() method is being called before then this event is emitted else its not emitted.
Below examples illustrate the use of ‘finish’ event in Node.js:
hi program is ended. Write is completed.
In the above example, writable.end() method is called before the finish event so it is emitted.
hi program is ended.
So, here writable.end() function is not called so the finish event is not executed.