How to get csv gzip content as a csv remotely (don’t want to save csv file locally)

Suppose I download a ‘abc.csv.gz’ file from ftp, now I need to get this file content as a csv remotely, dont want to save it locally.

With the help of below code I can get csv file content, but in case of gunzip ‘abc.csv.gz’, below code is not working.

Please suggest require changes in this code Or if have any idea how to read csv.gz content as csv (remotely) please suggest.

My working code for csv

    const fs = require('fs'); 
    const csv = require('csv-parser');

    fs.createReadStream('./abc.csv')
    .pipe(csv())
    .on('data', async function(value){

     console.log(value); 
    //can get csv file data here

    }).on('end', async function(){
     console.log("csv file ended");            
    }); 

Answer

You can use use zlib.

const fs = require('fs'); 
const csv = require('csv-parser');
const zlib = require('zlib');

fs.createReadStream('./abc.csv')
.pipe(zlib.createUnzip())
.pipe(csv())
.on('data', async function(value){

 console.log(value); 
//can get csv file data here

}).on('end', async function(){
 console.log("csv file ended");            
});