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

264
Vistas
React and Node app download zip file from REST API

I have a React and Node app and I have a table with download button. When I click the download button it makes a request to the node app which I want it to make a call to a REST API to download a zip file in the browser.

I managed to download the zip file by linking the REST API url directly from React but my manager told me not to expose the API url and mask it through Node.

I tried different methods that I found on the web but none of them work, just one that downloaded a zip that contained a file that contained base64 of the files probably.

I would like a solution both for React and Node how to download from a REST API.

Thanks

React code:

 $("#example tbody").on('click', '#buton123', function() {
   
   
  var 
   id=response.data.mesaje[$(this).closest('tr').index()].id;
 
   article2 = {id2:id} 
   axios.post('http://localhost:3001/descarcare',article2)
   .then((respo 
    nse)=>{
   //How to download zip from node 
   })

   });

Node code:

app.post('/descarcare', function(req, res) {

var id = req.body.id2;
console.log(id);


axios.get('http://restapi.com/aaa?id=123').then((response)=>{
//Code to download zip from rest api
)}




});
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

You can do one thing make api request to your source zip file containing rest api from nodejs and get stream data and then pipe it res. In this way you can get stream data directly to react js application from nodejs application

about 4 years ago · Juan Pablo Isaza Denunciar

0

Check jszip and jszip-utils libraries available for zipping the content.

about 4 years ago · Juan Pablo Isaza Denunciar
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