How to close a readable stream in Node.js?
var input = fs.createReadStream(\'lines.txt\'); input.on(\'data\', function(data) { // after closing the strea
This destroy module is meant to ensure a stream gets destroyed, handling different APIs and Node.js bugs. Right now is one of the best choice.
NB. From Node 10 you can use the .destroy method without further dependencies.
.destroy