#compressing #format #design #modular #addition #flexible #decompressing

bin+lib paxit

Paxit is a flexible Rust library for compressing and decompressing files using various algorithms, with a modular design that allows easy addition of new compression formats

4 releases

new 0.1.3 Jan 11, 2025
0.1.2 Jan 5, 2025
0.1.1 Jan 4, 2025
0.1.0 Jan 2, 2025

#1 in #addition

Download history 114/week @ 2024-12-28 323/week @ 2025-01-04

437 downloads per month

MIT license

4MB
670 lines

Paxit

Paxit is a flexible Rust library for compressing and decompressing files using various algorithms, with a modular design that allows easy addition of new compression formats.

Features

  • Supports multiple compression formats: "bmp", "dds", "farbfeld", "gif", "hdr", "ico", "jpg", "jpeg", "xz", "gz", "png", "pbm", "pgm", "ppm", "tar", "tga", "tiff", "tif", "webp", "zip", "zst".
  • Modular design for easy addition of new compression algorithms.
  • Simple command-line interface for compressing and decompressing files.

Installation

To use Paxit, add the following to your Cargo.toml:

[dependencies]
paxit = "0.1.3"

Usage

Command-Line Interface Paxit provides a simple command-line interface for compressing and decompressing files.

Compression

To compress files, use the following command:

paxit compress <output_file> <input_files...>

For example, to compress file1.txt and file2.txt into archive.zip:

paxit compress archive.zip file1.txt file2.txt

Decompression

To decompress a file, use the following command:

paxit uncompress <input_file> <output_directory>

For example, to decompress archive.zip into the output directory:

paxit uncompress archive.zip output

Library Usage

You can also use Paxit as a library in your Rust projects. Here is an example of how to use it:

use paxit::algorithms::{Zip, Tar, Gunzip};
use paxit::pack::Pack;
use std::path::Path;

fn main() {
    let files = vec![Path::new("file1.txt"), Path::new("file2.txt")];
    let output = Path::new("archive.zip");

    let compressor = Zip;
    compressor.pack(files, output).unwrap();
}

Adding New Compression Algorithms

To add a new compression algorithm, simply create a new file in the algorithms directory and implement the Pack trait. The library will automatically detect and use the new algorithm.

Contributing

Contributions are welcome! Please open an issue or submit a pull request.

You can update the mod.rs file by running :

cargo r --bin gen_mod

License

This project is licensed under the MIT License.

Dependencies

~16–26MB
~423K SLoC