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

146
Views
El archivo gz cargado en Google Cloud está dañado

Necesito ayuda para cargar el archivo gzip en gcs. Estoy usando nest js y el paquete @google-cloud/storage.

 @Post('/uploadFile') async uploadFile(@Req() req: Request, @Res() res: Response) { req.setEncoding('utf-8'); req.on('data', (chunk) => { const storage = new Storage({ keyFilename: 'datastore.json' }); const bucket = storage.bucket('bucket_name'); let mimeType = req.headers.filetype; let file = req.headers.filename; const blob = bucket.file(file + ''); let strOut = ""; for (var i = 0; i < chunk.length; i++) { strOut += chunk[i].charCodeAt(0).toString(2); } blob.save(strOut, { metadata: { contentType: mimeType, contentEncoding: 'gzip' }, resumable: false, gzip:true }); });

Me enfrento a un problema al descargar el archivo de datos que se descargó, pero se muestra dañado/corrompido, puede que esté cargando el archivo .gz de forma incorrecta. Estoy transmitiendo el archivo .gz así

 fs.createReadStream("compressedData/" + names[i]).pipe( request.post( { headers: config.headers, url: "http://localhost:3000/uploadFile", }, (err, res) => { if (err) throw err; console.log(res.body, config); } ) );

aquí está mi configuración del lado del cliente

 config = { headers: { filetype: "application/gzip", filename: "sitemap/test-upload/" + names[i], token: "sadjfbkjbkjvkjvkvkcvkjxsdnkn", }, };

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!