COMPRESSO is a command-line application that compresses and decompresses text-based files using an efficient variable length huffman encoding algorithm. It reduces file sizes while preserving content integrity.
- Supports compression and decompression of text-based files (
.txt
,.md
,.json
,.js
,.py
,.csv
,.html
,.yml
, etc.) - Uses Huffman Encoding for optimized compression
- Command-line interface for easy usage
- Preserves original file structure
- Fast and lightweight
Ensure you have Node.js installed, then clone the repository:
# Clone the repository
git clone https://github.com/ShawonECE/compresso.git
cd compresso
To compress a text file, keep the file inside data/input/
and run:
npm run compress -- inputFileName.extension compressedFileName
Example:
npm run compress -- input.txt compressed
This will create a compressed .bin file in data/compressed/
as compressed.bin
.
To decompress a compressed file, keep the compressed file inside data/compressed/
and run:
npm run decompress -- compressedFileName outputFileName
Example:
npm run decompress -- compressed my_output
This will restore the file to data/output/
and the file name will be my_output.extension
.
text-compression-tool/
βββ data/
β βββ compressed/ # Stores compressed files
β βββ input/ # Stores input text files
β βββ output/ # Stores decompressed text files
βββ src/
β βββ modules/
β β βββ fileUtils/
| β β βββ readFile.js
| β β βββ writeFile.js
β β βββ text/
| β β βββ text-compression/
| | β β βββ compressor.js
| | β β βββ fileNameHandler.js
| | β β βββ huffmanEncoder.js
| | β β βββ huffmanTree.js
| | β β βββ structures.js
| β β βββ text-decompression/
| | β β βββ huffmanDecoder.js
| | β β βββ decompressor.js
| | β β βββ metadata.js
| βββ compress.js
β βββ decompress.js
βββ package.json
βββ README.md
- Compression: Reads the input file, builds a Huffman tree, and encodes the data efficiently.
- Decompression: Reads the compressed file, reconstructs the Huffman tree, and restores the original text.
- Node.js
v16+
Pull requests are welcome! Feel free to open an issue if you find a bug or have suggestions.
For any inquiries, contact: shahriar.shawon.ece@gmail.com