node return read csv file code example
Example 1: create csv file nodejs
const csv = require('csv-parser');
const fs = require('fs');
fs.createReadStream('data.csv')
.pipe(csv())
.on('data', (row) => {
console.log(row);
})
.on('end', () => {
console.log('CSV file successfully processed');
});
Example 2: how to read a csv file in nodejs
$ npm i -s csv-parser