Read a CSV file using streams. Optimized for big files. Reads 1 Million lines in lesser then a second!
const CSVRead = require('csv-read')
const csv = CSVRead.load('./data/test.csv', {
delimiter: ';'
})
csv.parse((line, index) => {
console.log(line) // Line as an object, using keys from first line
}).then((res) => {
// res contains the full parsed csv as an array
console.log(`${res.length} lines parsed`)
})
Set column delimiter, default: ,
Set column quote, default: "
Set new line char, default: \n
Optional, set column keys, if this is not set, the first line is used as column keys
Sets the column offset. Defaults to 0