StreamingZipWriter

Struct StreamingZipWriter 

Source
pub struct StreamingZipWriter<W: Write + Seek> { /* private fields */ }
Expand description

Streaming ZIP writer that compresses data on-the-fly

Implementations§

Source§

impl StreamingZipWriter<File>

Source

pub fn new<P: AsRef<Path>>(path: P) -> Result<Self>

Create a new ZIP writer with default compression level (6) using DEFLATE

Source

pub fn with_compression<P: AsRef<Path>>( path: P, compression_level: u32, ) -> Result<Self>

Create a new ZIP writer with custom compression level (0-9) using DEFLATE

Source

pub fn with_method<P: AsRef<Path>>( path: P, method: CompressionMethod, compression_level: u32, ) -> Result<Self>

Create a new ZIP writer with specified compression method and level

§Arguments
  • path - Path to the output ZIP file
  • method - Compression method to use (Deflate, Zstd, or Stored)
  • compression_level - Compression level (0-9 for DEFLATE, 1-21 for Zstd)
Source§

impl<W: Write + Seek> StreamingZipWriter<W>

Source

pub fn from_writer(writer: W) -> Result<Self>

Create a new ZIP writer from an arbitrary writer with default compression level (6) using DEFLATE

Source

pub fn from_writer_with_compression( writer: W, compression_level: u32, ) -> Result<Self>

Create a new ZIP writer from an arbitrary writer with custom compression level

Source

pub fn from_writer_with_method( writer: W, method: CompressionMethod, compression_level: u32, ) -> Result<Self>

Create a new ZIP writer from an arbitrary writer with specified compression method and level

§Arguments
  • writer - Any writer implementing Write + Seek
  • method - Compression method to use (Deflate, Zstd, or Stored)
  • compression_level - Compression level (0-9 for DEFLATE, 1-21 for Zstd)
Source

pub fn start_entry(&mut self, name: &str) -> Result<()>

Start a new entry (file) in the ZIP

Source

pub fn write_data(&mut self, data: &[u8]) -> Result<()>

Write uncompressed data to current entry (will be compressed and/or encrypted on-the-fly)

Source

pub fn finish(self) -> Result<W>

Finish ZIP file (write central directory and return the writer)

Auto Trait Implementations§

§

impl<W> Freeze for StreamingZipWriter<W>
where W: Freeze,

§

impl<W> !RefUnwindSafe for StreamingZipWriter<W>

§

impl<W> !Send for StreamingZipWriter<W>

§

impl<W> !Sync for StreamingZipWriter<W>

§

impl<W> Unpin for StreamingZipWriter<W>
where W: Unpin,

§

impl<W> !UnwindSafe for StreamingZipWriter<W>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.