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

305
Views
Download a file using node server when clicked on a button - react.js

I have a excel file (sample.xlsx) in the root of my app folder. I want to download the file using node server only. In the node server I download the the file using res.download() https://www.geeksforgeeks.org/express-js-res-download-function/

When I directly hit the url http://localhost:8080/downloadFile , it perfectly saves/downloads the excel sheet. But now, I want to create a button and then hit this url. Hence, I access the url by making a proxy api call in order to use res.download() in server file, but res.download does not seem to directly download the file. Instead it sends a response. But that response is in some other format..with special characters... like this: ��k�����f��[%3�Eq���RUB .. How do I convert or read this response data? (This response data is the content of the file I am trying to download ) ... My next idea was to take the response and convert it into a blob.. and then save/download as an excel file.

I am really stuck on this for a very long time. Any help is appreciated.

Note: I would like to download this file via node server only. .. I do not want to use the public folder to host the file on the front end server not do I want to use <a href = "" > technique.

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!