downzip icon indicating copy to clipboard operation
downzip copied to clipboard

Support for direct download (no-zip) of individual URLs

Open BoPeng opened this issue 3 years ago • 4 comments

Many thanks for creating this tool, which should help our users download multiple files from our website.

I have a somewhat strange request though: can downzip be extended to support downloading a single file without creating a zip? The reason for this is that we store our data on another host so chrome disallows direct download from the URL. Whereas downzip allows us to download multiple files from the host, it would be convenient for our users to download a single file using the same mechanism. I suppose the logic could be like

  1. If files contains multiple files, use .zip
  2. if files contains a single file and zipFileName is unspecified or does not end with .zip, download in original format.

BoPeng avatar Mar 18 '21 04:03 BoPeng

Seems pretty straightforward to implement. Would maybe gate this behind a parameter when downzip is instantiated which defaults to false. Would merge if it's a clean PR!

robbederks avatar Mar 23 '21 21:03 robbederks

I found https://github.com/jimmywarting/StreamSaver.js which shares the same "stream" idea and appears to provide what I need. I would love to have one less dependency if downzip can handle both cases but I am afraid that my level of JS is not enough to provide a PR to downzip, maybe testing and documentation if you can lead the effort.

BoPeng avatar Mar 23 '21 22:03 BoPeng

I'm sorry, I don't have the time at the moment to implement this. Will leave it open for if anyone else is interested!

robbederks avatar Mar 30 '21 14:03 robbederks

Maybe you can just outline, in a few sentences, where changes should be made?

BoPeng avatar Mar 30 '21 15:03 BoPeng

Closing due to inactivity. As mentioned, should be trivial to implement and would merge a PR to do this.

robbederks avatar Oct 05 '22 20:10 robbederks