Skip to content

Commit 8e49ab1

Browse files
committed
Update examples with new ZipEntry/ZipEntryBuilder
1 parent e9ae412 commit 8e49ab1

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

examples/actix_multipart/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Copyright (c) 2021 Harry [Majored] [hello@majored.pw]
33
// MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE
44

5-
use async_zip::Compression;
6-
use async_zip::write::{ZipFileWriter, EntryOptions};
5+
use async_zip::{Compression, ZipEntryBuilder};
6+
use async_zip::write::ZipFileWriter;
77

88
use std::path::Path;
99

@@ -58,8 +58,8 @@ async fn create_archive(mut body: Multipart) -> Result<String, anyhow::Error> {
5858
None => Uuid::new_v4().to_string(),
5959
};
6060

61-
let opts = EntryOptions::new(filename, Compression::Deflate);
62-
let mut entry_writer = writer.write_entry_stream(opts).await.unwrap();
61+
let builder = ZipEntryBuilder::new(filename, Compression::Deflate);
62+
let mut entry_writer = writer.write_entry_stream(builder).await.unwrap();
6363

6464
while let Some(chunk) = field.next().await {
6565
entry_writer.write_all_buf(&mut chunk?).await?;

examples/cli_compress/src/main.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
// Copyright (c) 2021 Harry [Majored] [hello@majored.pw]
22
// MIT License (https://github.com/Majored/rs-async-zip/blob/main/LICENSE)
33

4-
use async_zip::write::{ZipFileWriter, EntryOptions};
5-
use async_zip::Compression;
4+
use async_zip::write::ZipFileWriter;
5+
use async_zip::{Compression, ZipEntryBuilder};
66

77
use std::path::{Path, PathBuf};
88

@@ -85,8 +85,8 @@ async fn write_entry(filename: &str, input_path: &Path, writer: &mut ZipFileWrit
8585
let mut buffer = Vec::with_capacity(input_file_size);
8686
input_file.read_to_end(&mut buffer).await?;
8787

88-
let entry_options = EntryOptions::new(filename.into(), Compression::Deflate);
89-
writer.write_entry_whole(entry_options, &buffer).await?;
88+
let builder = ZipEntryBuilder::new(filename.into(), Compression::Deflate);
89+
writer.write_entry_whole(builder, &buffer).await?;
9090

9191
Ok(())
9292
}

0 commit comments

Comments
 (0)