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

128
Views
Enviar archivo como búfer
const resp = await client.render(data); const Writable = require('stream').Writable; var buffer = []; const myWritable = new Writable({ write(chunk, encoding, callback) { console.log(encoding); buffer += chunk; callback(); }, }); myWritable.on('finish', () => { res.writeHead(200, { 'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'Content-Disposition': `inline; filename=Non Billed Jobs.xlsx`, }); res.end(buffer); }); resp.pipe(myWritable);

¿Por qué esto no descarga el archivo? Intentando descargar algo de jsreport pero si registro el buffer , me da caracteres extraños

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Como sugirió Aneesh , devolver un búfer sería ideal

 res.set('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'); res.set('Content-Disposition', 'inline; filename=Non Billed Jobs.xlsx'); res.send(new Buffer(BUFFER_DATA, 'base64');

También podría usar la función Buffer.from() en su lugar.

¡Espero que haya ayudado!

over 4 years ago · Santiago Trujillo Report
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!