This project implements two popular compression algorithms in both Rust and JavaScript:
- Run-Length Encoding (RLE)
- Lempel-Ziv (LZ) Compression
.
├── rust-compressor/ # Rust implementation
└── js-compressor/ # JavaScript implementation
- Rust (latest stable version)
- Cargo (comes with Rust)
- Clone the repository:
git clone https://github.com/benie-joy-possi/Compression-Tool.git
cd compression-project/rust-compressor- Build the project:
cargo build --releaseThe Rust implementation provides a command-line interface with the following options:
- RLE Compression:
cargo run -- compress <input_file> <output_file> --rle- LZ Compression:
cargo run -- compress <input_file> - <output_file> --lz- RLE Decompression:
cargo run -- decompress <input_file> <output_file> --rle- LZ Decompression:
cargo run -- decompress <input_file> <output_file> --lz-
Run-Length Encoding (RLE)
- Efficient for files with repeated sequences
- Simple and fast compression algorithm
- Best suited for data with long runs of repeated bytes
-
Lempel-Ziv (LZ) Compression
- More sophisticated compression algorithm
- Better compression ratios for general-purpose data
- Identifies and encodes repeated patterns in the data
- Node.js (latest LTS version)
- npm (comes with Node.js)
- Clone the repository:
git clone https://github.com/benie-joy-possi/Compression-Tool.git
cd compression-project/js-compressor- Install dependencies:
npm installThe JavaScript implementation provides a command-line interface with the following options:
- RLE Compression:
node index.js --compress --input=<input_file> --output= <output_file> --rle- LZ Compression:
node index.js --compress --input=<input_file> --output= <output_file> --lz- RLE Decompression:
node index.js --decompress --input=<input_file> --output= <output_file> --rle- LZ Decompression:
node index.js --decompress --input=<input_file> --output= <output_file> --lzThe JavaScript implementation provides the same compression algorithms as the Rust version:
-
Run-Length Encoding (RLE)
- Efficient for files with repeated sequences
- Simple and fast compression algorithm
- Best suited for data with long runs of repeated bytes
-
Lempel-Ziv (LZ) Compression
- More sophisticated compression algorithm
- Better compression ratios for general-purpose data
- Identifies and encodes repeated patterns in the data
The JavaScript implementation also includes Docker support. To build and run using Docker:
cd js-compressor
docker build -t js-compressor .
docker run -v $(pwd):/app js-compressor [commands]