parsing csv file using fast-csv

Viewed 719

    var fs = require('fs');
    var csv = require('fast-csv');
    var inputFile = "SampleCSVFile_2kb.csv";
    fs.createReadStream(inputFile)
            .pipe(csv())
            .on('data', function(data){
                console.log(data);
            })
            .on('end', function(){
                console.log('Read finished');
            })

my csv file :

 hello,1,1,forty-two,
 yellow,brown,red,orange

fs.createReadStream(inputFile)
            .pipe(csv())
            .on('data', function(data){
                console.log(data);
            })
            .on('end', function(){
                console.log('Read finished');
            })

i am using fast-csv to parse my csv file but i couldnt see any output , any help would be great

0 Answers
Related