1
0
Fork 0

async_zip version bump

Zynh Ludwig 2024-08-29 22:42:05 -07:00
parent 24de1be29b
commit e3c97c7a8e
3 changed files with 27 additions and 9 deletions

30
Cargo.lock generated
View File

@ -88,9 +88,9 @@ dependencies = [
[[package]] [[package]]
name = "async-compression" name = "async-compression"
version = "0.3.15" version = "0.4.12"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "942c7cd7ae39e91bde4820d74132e9862e62c2f386c3aa90ccf55949f5bad63a" checksum = "fec134f64e2bc57411226dfc4e52dec859ddfc7e711fc5e07b612584f000e4aa"
dependencies = [ dependencies = [
"flate2", "flate2",
"futures-core", "futures-core",
@ -123,14 +123,13 @@ dependencies = [
[[package]] [[package]]
name = "async_zip" name = "async_zip"
version = "0.0.13" version = "0.0.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "79eaa2b44cfdce59cfff6cb013c96900635085fe7c28fbcbe926c9e5ad0ddfbc" checksum = "00b9f7252833d5ed4b00aa9604b563529dd5e11de9c23615de2dcdf91eb87b52"
dependencies = [ dependencies = [
"async-compression", "async-compression",
"crc32fast", "crc32fast",
"futures-util", "futures-lite",
"log",
"pin-project", "pin-project",
"thiserror", "thiserror",
"tokio", "tokio",
@ -734,6 +733,19 @@ version = "0.3.30"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1"
[[package]]
name = "futures-lite"
version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5"
dependencies = [
"fastrand",
"futures-core",
"futures-io",
"parking",
"pin-project-lite",
]
[[package]] [[package]]
name = "futures-macro" name = "futures-macro"
version = "0.3.30" version = "0.3.30"
@ -1683,6 +1695,12 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "56d80efc4b6721e8be2a10a5df21a30fa0b470f1539e53d8b4e6e75faf938b63" checksum = "56d80efc4b6721e8be2a10a5df21a30fa0b470f1539e53d8b4e6e75faf938b63"
[[package]]
name = "parking"
version = "2.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae"
[[package]] [[package]]
name = "parking_lot" name = "parking_lot"
version = "0.12.3" version = "0.12.3"

View File

@ -9,7 +9,7 @@ edition = "2021"
[dependencies] [dependencies]
async-bincode = { version = "0.7.0", features = ["tokio"] } async-bincode = { version = "0.7.0", features = ["tokio"] }
async-trait = "0.1.81" async-trait = "0.1.81"
async_zip = { version = "0.0.13", features = [ async_zip = { version = "0.0.17", features = [
"deflate", "deflate",
"tokio", "tokio",
"tokio-fs", "tokio-fs",

View File

@ -203,7 +203,7 @@ async fn upload_to_zip(
let mut archive = tokio::fs::File::create(&archive_path) let mut archive = tokio::fs::File::create(&archive_path)
.await .await
.map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?; .map_err(|err| (StatusCode::INTERNAL_SERVER_ERROR, err.to_string()))?;
let mut writer = ZipFileWriter::new(&mut archive); let mut writer = ZipFileWriter::with_tokio(&mut archive);
while let Some(field) = body.next_field().await.unwrap() { while let Some(field) = body.next_field().await.unwrap() {
let file_name = match field.file_name() { let file_name = match field.file_name() {
@ -217,7 +217,7 @@ async fn upload_to_zip(
let body_with_io_error = stream.map_err(io::Error::other); let body_with_io_error = stream.map_err(io::Error::other);
let mut body_reader = StreamReader::new(body_with_io_error); let mut body_reader = StreamReader::new(body_with_io_error);
let builder = ZipEntryBuilder::new(file_name, Compression::Deflate); let builder = ZipEntryBuilder::new(file_name.into(), Compression::Deflate);
let mut entry_writer = writer let mut entry_writer = writer
.write_entry_stream(builder) .write_entry_stream(builder)
.await .await