D. Singh D. Singh - 1 year ago 122
Node.js Question

Node js does not parse the csv file using fast-csv library

I'm using the fast-csv node library to parse a csv-file named myFile.csv. The code looks like this:

var csv = require("fast-csv");
var fs = require("fs");
var stream = fs.createReadStream('myFile.csv');
.fromStream(stream, {headers : true})
.on("data", function(data){
console.log("Start of parsing...");
.on("end", function(data){
console.log("End of parsing");

When I run it, I see the following two lines in node console:

End of parsing

It doesn't print "Start of parsing..." or any data from the csv file. What could be the reason for that? Thanks in advance!

Answer Source

Just reinstall fast-csv module by using the following command:

npm install fast-csv --save