mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-24 14:28:42 +00:00
Optimize extract_zip
: Use async_zip::read::stream::ZipFileReader
to avoid temporary file (#590)
* Add new dep async_zip v0.0.9 to binstalk-downloader with features "gzip", "zstd", "xz", "bzip2", "tokio". * Refactor: Simplify `async_extracter::extract_*` API * Refactor: Create newtype wrapper of `ZipError` so that the zip can be upgraded without affecting API of this crate. * Enable feature fs of dep tokio in binstalk-downloader * Rewrite `extract_zip` to use `async_zip::read::stream::ZipFileReader` which avoids writing the zip file to a temporary file and then read it back into memory. * Refactor: Impl new fn `await_on_option` and use it * Optimize `tokio::select!`: Make them biased and check for cancellation first to make cancellation takes effect ASAP. * Rm unused dep zip from binstalk-downloader Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
e6f969245a
commit
3b1a7f2c78
8 changed files with 372 additions and 94 deletions
|
@ -12,6 +12,7 @@ license = "GPL-3.0"
|
|||
[dependencies]
|
||||
async-trait = "0.1.59"
|
||||
async-compression = { version = "0.3.15", features = ["gzip", "zstd", "xz", "bzip2", "tokio"] }
|
||||
async_zip = { version = "0.0.9", features = ["deflate", "bzip2", "lzma", "zstd", "xz"] }
|
||||
binstalk-types = { version = "0.1.0", path = "../binstalk-types" }
|
||||
bytes = "1.3.0"
|
||||
bzip2 = "0.4.3"
|
||||
|
@ -29,7 +30,7 @@ scopeguard = "1.1.0"
|
|||
tar = { package = "binstall-tar", version = "0.4.39" }
|
||||
tempfile = "3.3.0"
|
||||
thiserror = "1.0.37"
|
||||
tokio = { version = "1.22.0", features = ["macros", "rt-multi-thread", "sync", "time"], default-features = false }
|
||||
tokio = { version = "1.22.0", features = ["macros", "rt-multi-thread", "sync", "time", "fs"], default-features = false }
|
||||
tokio-tar = "0.3.0"
|
||||
tokio-util = { version = "0.7.4", features = ["io"] }
|
||||
tower = { version = "0.4.13", features = ["limit", "util"] }
|
||||
|
@ -39,14 +40,6 @@ url = "2.3.1"
|
|||
|
||||
xz2 = "0.1.7"
|
||||
|
||||
# Disable all features of zip except for features of compression algorithms:
|
||||
# Disabled features include:
|
||||
# - aes-crypto: Enables decryption of files which were encrypted with AES, absolutely zero use for
|
||||
# this crate.
|
||||
# - time: Enables features using the [time](https://github.com/time-rs/time) crate,
|
||||
# which is not used by this crate.
|
||||
zip = { version = "0.6.3", default-features = false, features = ["deflate", "bzip2", "zstd"] }
|
||||
|
||||
# zstd is also depended by zip.
|
||||
# Since zip 0.6.3 depends on zstd 0.11, we can use 0.12.0 here
|
||||
# because it uses the same zstd-sys version.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue