Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getBinaryContent : handle multiple urls at once #7

Open
dduponchel opened this issue Sep 2, 2014 · 7 comments
Open

getBinaryContent : handle multiple urls at once #7

dduponchel opened this issue Sep 2, 2014 · 7 comments

Comments

@dduponchel
Copy link
Collaborator

Downloading more than one file is common (like in the JSZip downloader example).

getBinaryContent could take an array of urls :

JSZipUtils.getBinaryContent(["path1", "path2"], function (err, dataArray) {...})

See also Stuk/jszip#168.

@abitdodgy
Copy link

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.

@dduponchel
Copy link
Collaborator Author

You mean a split zip file ? JSZip doesn't support them.

@abitdodgy
Copy link

@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?

@dduponchel
Copy link
Collaborator Author

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.

@noelvo
Copy link

noelvo commented Dec 6, 2015

@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.

@abitdodgy
Copy link

@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.

@chenster
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants