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

286
Views
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
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!