Open dduponchel opened 9 years ago
Is it not possible to download a zip that consists of multiple remote files? We have a usecase where users select multiple files and request a download. We'd rather not implement this on the server, if at all possible.
You mean a split zip file ? JSZip doesn't support them.
@dduponchel not a split zip, rather a single zip file that has several files download from a remote location. So, let's say I have three files a, b, and c.jpg hosted on S3, I would like to create a single zip file images.zip
that contains all three files. Is that possible? Or is it a one file per zipped file only?
JSZipUtils.getBinaryContent
handles one file per call, but you can call it several times to fill in a zip object, see http://stuk.github.io/jszip/documentation/examples/downloader.html for example.
@abitdodgy I guess you have figured out how to solve the problem of download multiple files and zip to 1 file. Here is how I do it https://gist.github.com/noelvo/4502eea719f83270c8e9. I am wondering how you implemented.
@noelvo in the end I use d a Ruby library to stream the files from the CDN. It's worked well for me, especially because I needed to do some server side processing before streaming the file back the user.
It's a problem I think due to the nature of ajax call being async. A lot times you get empty zip file before content from Ajax was even returned.
Downloading more than one file is common (like in the JSZip downloader example).
getBinaryContent
could take an array of urls :See also Stuk/jszip#168.