zbsdiff-cli 1.5.2

CLI tools for zbsdiff
`zbsdiff`
=======

[![Crates.io Version](https://img.shields.io/crates/v/zbsdiff?style=flat&logo=rust&logoColor=%23ffff&label=Crates.io&labelColor=%235452f1&color=%23282696)](https://crates.io/crates/zbsdiff)

Fast and memory saving bsdiff 4.x compatible delta compressor and patcher, fork of [`qbsdiff`](https://github.com/hucsmn/qbsdiff).

This project is a Rust workspace containing:

- **`zbsdiff`**: The core library for diffing and patching.
- **`zbsdiff-cli`**: Command-line tools for manual operations.
- **`zbsdiff-test-utils`**: Internal testing and benchmarking helpers.

Add library dependency to `Cargo.toml`:

```toml
[dependencies]
zbsdiff = "1.5"
```

Features
--------

- **Performance:** Optimized for speed and low memory usage.
- **Parallelization:** Supports multi-threaded diffing with **fixed-size** or **Content-Defined Chunking (CDC)** schemes.
- **Extensibility:** Decoupled diffing engine and storage format via `PatchWriter` and `PatchReader` traits. Use any compressor (zstd, gzip, etc.) by implementing the traits.

Build commands
--------------

Build the `zbsdiff` and `zbspatch` CLI tools:

```shell
cargo build --release -p zbsdiff-cli
cd target/release
./zbsdiff --help
./zbspatch --help
```

Install commands to `$CARGO_HOME/bin`:

```shell
cargo install zbsdiff-cli
```

Examples
--------

Produce the target stream by applying `patch` to `source`:

```rust
use std::io;
use zbsdiff::Bspatch;

fn bspatch(source: &[u8], patch: &[u8]) -> io::Result<Vec<u8>> {
    let patcher = Bspatch::new(patch)?;
    let mut target = Vec::new();
    patcher.apply(source, io::Cursor::new(&mut target))?;
    Ok(target)
}
```

Produce the patch data by comparing `source` with `target`:

```rust
use std::io;
use zbsdiff::Bsdiff;

fn bsdiff(source: &[u8], target: &[u8]) -> io::Result<Vec<u8>> {
    let mut patch = Vec::new();
    Bsdiff::new(source, target)
        .compare(io::Cursor::new(&mut patch))?;
    Ok(patch)
}
```

Note that `zbsdiff` would not generate exactly the same patch file as `bsdiff`.
Only the patch file format is promised to be compatible.

License
-------

Licensed under either of

- Apache License, Version 2.0 ([LICENSE-APACHE]./LICENSE-APACHE or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT]./LICENSE-MIT or <http://opensource.org/licenses/MIT>)

at your option.