node.js - callback to handle completion of pipe -
I am using the following node. Js code to download documents from some URL and save it in disk. I should be informed about the document when the document has been downloaded. I have not seen any callback with pipes. Or is there any 'end' event that can be captured upon completion of the download?
request (some_url_doc) .pip (fs.createWriteStream ('xyz .doc'));
is the stream EventEmitter s so you can hear something . As you said, there is a finish event for the request (first end ). var stream = request (...). Pipe (...); Stream.on ('finish', function () {...}); For more information, you can test which incidents are available.
Comments
Post a Comment