Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

129
Views
nodejs extract/decompress all content of .gz compressed files to directory
  1. i have a file in the file system named temp.gz
  2. the temp gzip file contains files and folder
  3. i would like to extract them and have them in a folder like we would normally unzip a file in OS.

i have tried below code but thats not meant for extracting files to folder.

    const unzip = zlib.createUnzip();
    var input = fs.createReadStream(inFilename); /path/to/temp.gz
   
    var output = fs.createWriteStream(outFilename); /path/to/output/folder

Above didnt work and i believe the reason is that it writes to a file and i have provided a directoy.

my requirement is extract files to directory.

        zlib.gzip(responseData, (err, buffer) => {
  
         // Calling gunzip method
        zlib.gunzip(buffer, (err, buffer) => {
        
           console.log(buffer,pathFileName);
           fs.appendFileSync(pathFileName, buffer);

           });
        });

above i was trying to unzip as per the docs and write buffer to the output file and didnt create a folder as expected and didnt add the files there

sure i am missing something but not sure what.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!