Node JS process is not exiting after reading file via readline under Windows:
const readline = require('readline');
const fs = require('fs');
const rs = fs.createReadStream('../data/lorem.txt');
const rl = readline.createInterface({
input: rs
});
rl.on('line', function(line) {
console.log(line);
});
setTimeout(function () {
rl.close();
// tried these too:
// rs.close();
// rs.destroy();
},1000);
I don't want to use process.exit(0) because I am processing multiple files, and the fact that node is not exiting tells me that it is holding up some resources. How do I release them properly?
via amaksr
No comments:
Post a Comment