readline sample
var rl = readline.createInterface({ | |
input: fs.createReadStream(filePath), | |
crlfDelay: Infinity | |
}) | |
rl.on('line', async (line) => { | |
counter += 1 | |
rl.pause() | |
// some async code | |
rl.resume() | |
}) | |
rl.on('close', () => { | |
// some task on close | |
}) | |
rl.on('error', error => console.error(error)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment