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

309
Vistas
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
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