I am trying something like the following, but this doesn't work
const parser = parse(req.file, {
headers: true
})
// Use the readable stream api
parser.on('data', function(csvrow) {
console.log(csvrow);
})
I am trying something like the following, but this doesn't work
const parser = parse(req.file, {
headers: true
})
// Use the readable stream api
parser.on('data', function(csvrow) {
console.log(csvrow);
})
This worked for me
parse(sampleFile, {columns: true}, function(err, data){
console.log(JSON.stringify(data,null,2));
});