huff_rs

Crates.iohuff_rs
lib.rshuff_rs
version0.2.1
created_at2021-03-01 14:48:06.283677+00
updated_at2025-11-16 00:35:14.807735+00
descriptionEncode and decode files with Huffman coding.
homepage
repositoryhttps://github.com/Treeniks/huff_rs
max_upload_size
id362219
size28,564
Thomas Lindae (Treeniks)

documentation

README

huff_rs

Crates.io GitHub last commit License

I created this for fun after having to implement Huffman coding for a university project. It utilizes the bitvec crate to create the bitsequences. The performance of this program is honestly pretty bad. The file format for the compressed files is something arbitrary I came up with.

Building

git clone https://github.com/Treeniks/huff_rs
cd huff_rs
cargo build --release
./target/release/huff_rs --version

Installation

cargo install huff_rs

Usage

Encode

To encode a file:

huff_rs encode file.txt

The default output filename will be the same as the input with the extension replaced by .huff. You can also specify the output filename with -o:

huff_rs encode file.txt -o compressed.huff

Decode

To decode a file:

huff_rs decode file.huff

The default output filename will be the same as the input with the extension replaced by .txt. You can also specify the output filename with -o:

huff_rs decode file.huff -o original.txt

TODO

  • adding checks for correct file format in decode
  • tests
Commit count: 0

cargo fmt