parse-csv-stream
Parse any csv file via stream or csv stream from any other source in Node.js for various usecases like database insertion, logging, file creation, batch processing data etc.
Example:
const parse_csv = require('parse-csv-stream');
const fs = require('fs');
const readStream = fs.createReadStream('./test.csv', 'utf8');
const writeStream = fs.createWriteStream('./test.json');
const options = {
};
const parser = new parse_csv(options);
const events = parser.events;
events.on('data', (row) => {
console.log(row);
})
readStream.on('data', (chunk) => {
let resultset = parser.parse(chunk);
});
readStream.pipe(parser).pipe(writeStream);
Built With
- Native Node.js modules
- No external dependencies.
Authors
License
[MIT License] © Ayush Pratap