mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-05-14 16:00:03 +00:00
Bump async_zip from 0.0.13 to 0.0.15 (#1022)
* Bump async_zip from 0.0.13 to 0.0.15 Bumps [async_zip](https://github.com/Majored/rs-async-zip) from 0.0.13 to 0.0.15. - [Release notes](https://github.com/Majored/rs-async-zip/releases) - [Commits](https://github.com/Majored/rs-async-zip/commits) --- updated-dependencies: - dependency-name: async_zip dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix build error Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> --------- Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
52e2368e6c
commit
763ddd0427
4 changed files with 48 additions and 20 deletions
|
@ -6,7 +6,7 @@ use std::{
|
|||
path::{Component, Path, PathBuf},
|
||||
};
|
||||
|
||||
use async_zip::tokio::read::stream::ZipFileReader;
|
||||
use async_zip::base::read::stream::ZipFileReader;
|
||||
use bytes::{Bytes, BytesMut};
|
||||
use futures_lite::stream::Stream;
|
||||
use tokio::sync::mpsc;
|
||||
|
@ -50,12 +50,18 @@ where
|
|||
debug!("Decompressing from zip archive to `{}`", path.display());
|
||||
|
||||
let reader = StreamReader::new(stream);
|
||||
let mut zip = ZipFileReader::new(reader);
|
||||
let mut zip = ZipFileReader::with_tokio(reader);
|
||||
let mut buf = BytesMut::with_capacity(4 * 4096);
|
||||
let mut extracted_files = ExtractedFiles::new();
|
||||
|
||||
while let Some(mut zip_reader) = zip.next_entry().await.map_err(ZipError::from_inner)? {
|
||||
extract_zip_entry(&mut zip_reader, path, &mut buf, &mut extracted_files).await?;
|
||||
while let Some(mut zip_reader) = zip.next_with_entry().await.map_err(ZipError::from_inner)? {
|
||||
extract_zip_entry(
|
||||
zip_reader.reader_mut(),
|
||||
path,
|
||||
&mut buf,
|
||||
&mut extracted_files,
|
||||
)
|
||||
.await?;
|
||||
|
||||
// extract_zip_entry would read the zip_reader until read the file until
|
||||
// eof unless extract_zip itself is cancelled or an error is raised.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue