As the title states, I was wondering if it is possible to use promisify
(https://nodejs.org/dist/latest-v8.x/docs/api/util.html#util_util_promisify_original) for readline
in node.js? I was only able to do it like this:
let data = [];
const parse = () => {
return new Promise((resolve, reject) => {
const rl = readline.createInterface({
input: fs.createReadStream(path)
});
rl.on('line', (line) => {
data.push(line);
});
rl.on('close', () => {
resolve(data);
});
});
};