Sha256: 13a72eb1759f86309f3e084263b247ccc23f686d483a57c862f69c79e87f2600

Contents?: true

Size: 812 Bytes

Versions: 13

Compression:

Stored size: 812 Bytes

Contents

use clap::Parser;
use std::io;
use std::path::PathBuf;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about=None)]
/// This program trains a dictionary from one or more files,
/// to make future compression of similar small files more efficient.
///
/// The dictionary will need to be present during decompression,
/// but if you need to compress many small files individually,
/// it may be worth the trouble.
struct Args {
    /// Maximum dictionary size in bytes.
    #[arg(short, long)]
    max_size: usize,

    /// Files to use as input.
    files: Vec<PathBuf>,
}

fn main() {
    let args = Args::parse();

    let dict = zstd::dict::from_files(&args.files, args.max_size).unwrap();

    let mut dict_reader: &[u8] = &dict;
    io::copy(&mut dict_reader, &mut io::stdout()).unwrap();
}

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-28.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-27.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-26.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-25.0.2 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-25.0.1 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-25.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-24.0.0 ./ext/cargo-vendor/zstd-0.13.2/examples/train.rs
wasmtime-23.0.2 ./ext/cargo-vendor/zstd-0.13.1/examples/train.rs
wasmtime-22.0.0 ./ext/cargo-vendor/zstd-0.13.1/examples/train.rs
wasmtime-21.0.1 ./ext/cargo-vendor/zstd-0.13.1/examples/train.rs
wasmtime-20.0.2 ./ext/cargo-vendor/zstd-0.13.1/examples/train.rs
wasmtime-20.0.0 ./ext/cargo-vendor/zstd-0.13.1/examples/train.rs