Streaming CSV parser for node.js streams
npm install zstreams-csv-parse``javascript
var CSVParse = require('zstreams-csv-parse');
// Input: test.txt
// Name|Quantity|Price
// Cheeseburger|1|5.80
// Water|3|0
var csvParse = new CSVParse({
delimiter: '|'
});
zstreams.fromFile('test.txt').pipe(csvParse).pipe(process.stdout);
// Output
// ["Name", "Quantity", "Price"]
// ["Cheeseburger", "1", "5,80"]
// ["Water", "3", "0"]
`
It's a streaming CSV parser. 'Nuff said.
The following options are accepted:
* delimiter: The record delimiter in the input data. Defaults to ','.escape
* : The record quote character. Defaults to '"'.mapHeaders
* : If this is set to true, instead of returning arrays, this stream will return objectsheaders
mapping each spreadsheet header to its respective cell. The first row read form the file will be
treated as the header row.
* : An array of strings. If mapHeaders` is set and the spreadsheet being parsed has no header
row, use this to manually set the headers.