nodeJS - csv parse with createReadStream, how can every chunk be converted to an object

371 Views Asked by At

I was using the csv-parse package with the createReadStream method.

fs.createReadStream('rando.csv')
    .pipe(parse({
        comment: '#', 
        columns: true, 
    }))
    .on('data', (data) => {
        console.log(data);
        
    })

The above code logs objects, my question is, is it reading the csv file row by row? or else what it prints wouldn't be a complete object right? Is a chunk equal to one line?

0

There are 0 best solutions below