Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

136
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda