Basic (and naïve) LZW and Huffman compression algorithms in Rust.

Overview

Naive implementation of the LZW and Huffman compression algorithms.

To run, install the Rust toolchain. Cargo may be used to compile the source.

Example,

$ cargo run

Usage: cmpr [OPTIONS] -a <ALGORITHM> <COMMAND>

Commands:
  compress
  decompress
  help        Print this message or the help of the given subcommand(s)

Options:
  -a <ALGORITHM>      The algorithm to use for compress or decompress [possible values: lzw, huffman]
      --stats         Whether the program should show statistics
  -h, --help          Print help
  -V, --version       Print version

Compress a file using the LZW algorithm (assuming cargo build --release):

$ ./target/release/cmpr -a lzw --stats compress -o Cargo.lock.lzw Cargo.lock
done.
    in 1 ms
    saved 35.10%

Decompress the same file:

$ ./target/release/cmpr -a lzw --stats decompress -o recovered-Cargo.lock Cargo.lock.lzw
done.
    in 0 ms

The script cmp.sh may be used to test the compression algorithm by compressing, decompressing and comparing with the original file. E.g.,

$ ./cmp.sh Cargo.lock
    Finished release [optimized] target(s) in 0.06s
cmpr 0.1.0
compressing [Cargo.lock] into [Cargo.lock.cmp]...
done.
    in 1 ms
    saved 35.10%
decompressing [Cargo.lock.cmp] into [recovered-Cargo.lock]...
done.
    in 2 ms
ok
You might also like...
Michael's Compression Algorithm

mca This repository contains a compression algorithm written by me (Michael Grigoryan). The algorithm is only able to compress and decompress text fil

A simple rust library to read and write Zip archives, which is also my pet project for learning Rust

rust-zip A simple rust library to read and write Zip archives, which is also my pet project for learning Rust. At the moment you can list the files in

A Brotli implementation in pure and safe Rust

Brotli-rs - Brotli decompression in pure, safe Rust Documentation Compression provides a Read-struct to wrap a Brotli-compressed stream. A consumer

Brotli compressor and decompressor written in rust that optionally avoids the stdlib

rust-brotli What's new in 3.2 into_inner conversions for both Reader and Writer classes What's new in 3.0 A fully compatible FFI for drop-in compatibi

DEFLATE, gzip, and zlib bindings for Rust

flate2 A streaming compression/decompression library DEFLATE-based streams in Rust. This crate by default uses the miniz_oxide crate, a port of miniz.

A Rust application that compress files and folders

Quick Storer This is a Rust application that compress files and folders. Usage Download or build the binary and place it on your desktop, or any other

A utility that can download JavaScript and TypeScript module graphs and store them locally in a special zip file.

eszip A utility that can download JavaScript and TypeScript module graphs and store them locally in a special zip file. To create a new archive: esz

Snappy bindings for Rust

Snappy [ Originally forked from https://github.com/thestinger/rust-snappy ] Documentation Usage Add this to your Cargo.toml: [dependencies] snappy = "

Tar file reading/writing for Rust

tar-rs Documentation A tar archive reading/writing library for Rust. # Cargo.toml [dependencies] tar = "0.4" Reading an archive extern crate tar; use

Owner
Luiz Felipe Gonçalves
Luiz Felipe Gonçalves
Huffman Encoding/Decoding

Huffman Encoding/Decoding This project is inspired by lab_huffman of CS225(2022fall) @ UIUC Team:    -- Chaoqi LIU ([email protected])    -- Jiahu

Chaoqi LIU 3 Dec 24, 2022
Like pigz, but rust - a cross platform, fast, compression and decompression tool.

?? crabz Like pigz, but rust. A cross platform, fast, compression and decompression tool. Synopsis This is currently a proof of concept CLI tool using

Seth 232 Jan 2, 2023
libbz2 (bzip2 compression) bindings for Rust

bzip2 Documentation A streaming compression/decompression library for rust with bindings to libbz2. # Cargo.toml [dependencies] bzip2 = "0.4" License

Alex Crichton 67 Dec 27, 2022
A Rust implementation of the Zopfli compression algorithm.

Zopfli in Rust This is a reimplementation of the Zopfli compression tool in Rust. I have totally ignored zopflipng. More info about why and how I did

Carol (Nichols || Goulding) 76 Oct 20, 2022
A reimplementation of the Zopfli compression tool in Rust.

Zopfli in Rust This is a reimplementation of the Zopfli compression tool in Rust. Carol Nichols started the Rust implementation as an experiment in in

null 11 Dec 26, 2022
lzlib (lzip compression) bindings for Rust

lzip Documentation A streaming compression/decompression library for rust with bindings to lzlib. # Cargo.toml [dependencies] lzip = "0.1" License Lic

Firas Khalil Khana 8 Sep 20, 2022
Obvious Unified Compression Helper is a CLI tool to help you compress and decompress files of several formats

Ouch! ouch stands for Obvious Unified Compression Helper and is a CLI tool to help you compress and decompress files of several formats. Features Usag

null 734 Dec 30, 2022
(WIP) Taking the pain away from file (de)compression

Ouch! ouch loosely stands for Obvious Unified Compression files Helper and aims to be an easy and intuitive way of compressing and decompressing files

Vinícius Miguel 734 Dec 30, 2022
gzp - Multi-threaded Compression

gzp - Multi-threaded Compression

Seth 123 Dec 28, 2022
Fastest Snappy compression library in Node.js

snappy !!! For [email protected] and below, please go to node-snappy. More background about the 6-7 changes, please read this, Thanks @kesla . ?? Help me to

LongYinan 103 Jan 2, 2023