You have two different endpoints that return a blob-like content, in this case pdf files, and you want to offer the user a one-click download with the files compressed into a single zip file.
What do you do?
Okay, the backend should return the zipped files, I agree. But what if you don't have a backend that does it for you? What if you have to consume completely different services to get these files?
In that case you'll want to be able to do this from the front end.
I'm using:
- Axios: to get remote files;
- JSZip: to zip the files obtained;
- file-saver: to save the zip file automatically.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes.
No prerequisites at all.
Install all libraries.
# npm install
Just run it.
# npm start
- Get filename or create randomly
- Create a container to add multiple URLs
- Add a loading visual component (progress bar?)