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

293
Vistas
How to return a file to frontend in Node.js

I am following this lib's easiest node.js example that generates ppt: https://gitbrent.github.io/PptxGenJS/docs/quick-start/

I first tried in React.js, the writeFile() downloads a file so it works, but I don't understand how to do it in Node.js,

I expect that the writeFile() returns a file so I can send back to client, but it returns a string which is confusing. Any help is appreciated, thank you

Code

const createPowerPoint=async(req,res)=>{
// 1. Create a Presentation
let pres = new pptxgen();

// 2. Add a Slide to the presentation
let slide = pres.addSlide();

// 3. Add text to the Slide
slide.addText("Hello World");

// 4. Save the Presentation
let file = await pres.writeFile({ fileName: "Sample Presentation.pptx" });
res.json(file)

}

Frontend log Frontend

Backend log enter image description here

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