I am using the following node.js code to download documents from some url and save it in the disk.
I want to be informed about when the document is downloaded. i have not seen any callback with pipe.Or, Is there any ‘end’ event that can be captured on completion of download ?
request(some_url_doc).pipe(fs.createWriteStream('xyz.doc'));
Streams are
EventEmitters so you can listen to certain events. As you said there is afinishevent for request (previouslyend).For more information about which events are available you can check the stream documentation page.