Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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
You can’t perform that action at this time.