Ler arquivo texto linha a linha com node.js
// https://nodejs.org/api/readline.html#readline_example_read_file_stream_line_by_line | |
const fs = require('fs'); | |
const readline = require('readline'); | |
const rl = readline.createInterface({ | |
input: fs.createReadStream('arquivo.tsv'), | |
crlfDelay: Infinity | |
}); | |
rl.on('line', linha => { | |
let campos = linha.split('\t'); // campos delimitados por tab | |
console.log( `Inscrição: ${campos[1]} - Evento: ${campos[2]} - Nome: ${campos[0]}` ); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment