rust-cached-path icon indicating copy to clipboard operation
rust-cached-path copied to clipboard

Improvements to archives handling

Open gbrls opened this issue 2 years ago • 4 comments

  • Added infer as a dependency so the inference of the archive type (zip, gzip) doesn't rely on the file extension.
  • Added option to extract the archive to a specific directory.
  • The raw archive is deleted after it's extracted. (This may cause problems, in my testings the archive are downloaded again if they're deleted)

gbrls avatar Oct 26 '23 22:10 gbrls

The raw archive is deleted after it's extracted. (This may cause problems, in my testings the archive are downloaded again if they're deleted)

Yea this probably break some assumptions, but I think we can fix that. If we keep track of the extraction path in the metadata we could avoid downloading again when the extraction path exists.

epwalsh avatar Oct 26 '23 23:10 epwalsh

~The redownload issue was fixed using the approach you wrote above! The extraction and deletion of the original archive seems to be working without breaking anything else now.~ (There might be some corner cases when combining the extraction_dir and subdir options).

I found a bug in my implementation, it's still redownloading the full archive.

gbrls avatar Oct 27 '23 14:10 gbrls

Makes total sense to me! I'll be back later with those changes, thank you for the reviews and guidance.

gbrls avatar Oct 27 '23 20:10 gbrls

This is related to #68, right? What's missing for this to work?

I was trying to download a .tar.zstd archive (but the URL has no file extension) with this crate and it would be great if it worked. :)

YtvwlD avatar Mar 17 '24 14:03 YtvwlD