Skip to main content

Module write

Module write 

Source
Expand description

A module which supports writing ZIP files.

§Example

§Whole data (u8 slice)

let mut writer = ZipFileWriter::new(Vec::<u8>::new());

let data = b"This is an example file.";
let opts = ZipEntryBuilder::new(String::from("foo.txt").into(), Compression::Deflate);

writer.write_entry_whole(opts, data).await?;
writer.close().await?;

§Stream data (unknown size & data)

let mut writer = ZipFileWriter::new(Vec::<u8>::new());

let data = b"This is an example file.";
let opts = ZipEntryBuilder::new(String::from("bar.txt").into(), Compression::Deflate);

let mut entry_writer = writer.write_entry_stream(opts).await?;
entry_writer.write_all(data).await.unwrap();

entry_writer.close().await?;
writer.close().await?;

Structs§

EntryStreamWriter
An entry writer which supports the streaming of data (ie. the writing of unknown size or data at runtime).
ZipFileWriter
A ZIP file writer which acts over AsyncWrite implementers.

Functions§

compressbzip2 or deflate64 or deflate or lzma or xz or zstd
Compresses the data of a ZIP entry using the specified compression method and level.
crc32
Performs a CRC32 checksum on the provided data.