Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

130
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda