jszip-utils icon indicating copy to clipboard operation
jszip-utils copied to clipboard

getBinaryContent : handle multiple urls at once

Open dduponchel opened this issue 10 years ago • 7 comments

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.

dduponchel avatar Sep 02 '14 21:09 dduponchel

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.

abitdodgy avatar Jul 24 '15 17:07 abitdodgy

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

dduponchel avatar Jul 27 '15 20:07 dduponchel

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

abitdodgy avatar Jul 27 '15 20:07 abitdodgy

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.

dduponchel avatar Jul 28 '15 19:07 dduponchel

@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 avatar Dec 06 '15 23:12 noelvo

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

abitdodgy avatar Dec 07 '15 10:12 abitdodgy

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.

chenster avatar Feb 24 '16 11:02 chenster