Function diff_zip

Source
pub fn diff_zip(
    path_before: String,
    path_after: String,
    diff_algorithm: DiffAlgorithm,
    compress_algorithm: CompressAlgorithm,
) -> Result<PatchSet, Error>
Expand description

Generates a patch set that can transform one zip archive into another.

Creates a set of operations that describe how to transform the contents of one zip archive into another, handling file additions, deletions, and modifications efficiently.

ยงExample

use files_diff::{diff_zip, DiffAlgorithm, CompressAlgorithm};

// Generate patches for transforming a zip archive
let patch_set = diff_zip(
    "v1.zip".to_string(),
    "v2.zip".to_string(),
    DiffAlgorithm::Rsync020,
    CompressAlgorithm::Zstd
)?;

// Check the total size of all patches
println!("Patch set size: {} bytes", patch_set.get_size());

The function handles:

  • Nested directory structures
  • File additions and deletions
  • File modifications using the specified diff algorithm
  • Directory creation and deletion