The Huffman Compression Algorithm is a lossless data compression algorithm used to reduce the size of files without losing any information. This Huffman Compression CLI program written in C++ that allows you to compress any file type to a .hufbin file format. The compressed file can be decompressed back to its original form using the same program.
To use the Huffman Compression CLI program, you need to have the following prerequisites installed on your system:
- C++ compiler (supporting C++11 or higher)
Follow the steps below to install and set up the Huffman Compression CLI program on your system:
-
Clone the repository:
git clone https://github.com/rohithpeddi7/huffman_encoding_compression/
-
Change into the project directory:
cd huffman_encoding_compression
-
Compile the source code using CMake:
gcc huffman.cpp -o huffman
Once you have successfully installed the Huffman Compression CLI program, follow the steps below to compress and decompress files:
To compress a file, run the following command:
./huffman c <input_file_path_with_extension> <output_file_name_without_extension>
Replace <input_file_path_with_extension>
with the path to the file you want to compress and <output_file_name_without_extension>
with the output file name without any extension.
You can also run without arguments and interact with the menu.
To decompress a compressed file, run the following command:
./huffman d <compressed_file_path_with_.hufbin> <output_file_name_with_extension>
Replace <compressed_file_path_with_.hufbin>
with the path to the compressed file you want to decompress and <output_file_name_without_extension>
with the output file name with file extension that you require.
Contributions to the Huffman Compression CLI program are welcome. If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.
This Huffman Compression CLI program is licensed under the MIT License.