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

265
Views
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 answers
Answer question

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 Report

0

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

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