Download them all direct url
The browser will do the rest to download the file.Ĭonst downloadMany = urls => Conclusion Once I have a file URL in hand, the work on the client is pretty simple: open this URL in a new tab.
I choose the 2nd approach since I want to cache all the generated files. The backend can respond raw file content directly via HTTP request or upload file to another storage and return file URL. If you didn’t, I would recommend you to get to know them first and come back here :) Download a single fileīefore applying new solutions, my system allows downloading a single report file. In this post, I will work through how I do it.ĭisclaimer: In this post, I’ll assume you already had basic knowledge about Javascript and Promise.
#Download them all direct url zip#
The final solution I came up with is: download all the files to the browser and zip them there. My clients won’t mind if they wait for a few more seconds, or spend some extra MB of RAM on their laptop. It’s great if we can shift some computing to frontend and reduce the cost for the infrastructure.
#Download them all direct url zip file#
Generating a zip file takes a long time.With the approach above, I need to redo the whole thing all the time, it’s not really efficient. So, while the Zip file itself is not likely reusable, the single files do. Although the Zip files are different sets of reports, it’s very likely that most of the individual reports have been generated by an earlier request.