downzip
downzip copied to clipboard
Support for direct download (no-zip) of individual URLs
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
- If
files
contains multiple files, use .zip - if
files
contains a single file andzipFileName
is unspecified or does not end with.zip
, download in original format.
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!
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.
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!
Maybe you can just outline, in a few sentences, where changes should be made?
Closing due to inactivity. As mentioned, should be trivial to implement and would merge a PR to do this.