readStream.pause() is resuming while using pipe with csv-parser

88 views Asked by At

I want to read a csv file rows one by one and perform a third party call on them. but when i pause the stream it is getting resume before my response.

const csv = require('csv-parser');
const readStream = fs.createReadStream('data.csv');
readStream
    .pipe(csv())
    .on('data', async (row) => {
        readStream.pause();
        await processSomeThirdPartyCalls(row);
        readStream.resume();
    })

Let me know if I need to clarify more

0

There are 0 answers