javascript csvlibrary code example
Example: parse csv javascript
//Suppose you have a CSV file data.csv which contains the data:
//NAME,AGE
//Daffy Duck,24
//Bugs Bunny,22
const csv = require('csv-parser')
const fs = require('fs')
const results = [];
fs.createReadStream('data.csv')
.pipe(csv())
.on('data', (data) => results.push(data))
.on('end', () => console.log(results));
// [{ NAME: 'Daffy Duck', AGE: '24' },
// { NAME: 'Bugs Bunny', AGE: '22' } ]