This repository contains a C program for compressing and decompressing text files using Huffman coding. Huffman coding is a lossless data compression algorithm that assigns variable-length codes to input characters, with shorter codes assigned to more frequent characters.
- Huffman Coding: Implements Huffman coding for compressing text files.
- File Compression: Compresses input text files to reduce their size.
- Decompression: Decompresses the compressed files to restore the original text. (⚠ currently doesn't work)
- Clone the repository:
git clone https://github.com/ZahraAziziGit/compress-text-file.git
- Navigate to the project directory:
cd compress-text-file
- Compile the C program:
gcc compress.c -o run
To see the help menu, use the following command:
./run help
To compress a text file, use the following command:
./run compress path/to/your/file.txt
compress
: Command to compress the file.path/to/your/file.txt
: Path to the text file you want to compress.
Example:
./run compress file.txt
If your file is located in a different folder, for example on drive D: (windows)
./run compress D:\\path\\to\\your\\file.txt
To decompress a text file, use the following command:
./run decompress path/to/your/file.txt
decompress
: Command to decompress the file.path/to/your/file.txt
: Path to the compressed file you want to decompress.
Example:
./rune decompress file.txt
If your file is located in a different folder, for example on drive D: (windows)
./run decompress D:\\path\\to\\your\\file.txt
compress-text-file/
├── LICENSE.txt
├── README.md
└── compress.c
- src/compress.c: The main program file that handles input arguments and compresses and decompresses the file
⬜ Implement decompression code.
⬜ Separate Huffman code from the main code.
⬜ Refactor compressing function.
⬜ Refactor decompressing function.
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch:
git checkout -b <feature-name>
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin <feature-name>
- Open a pull request.
This project is licensed under the MIT License.
Thank you for checking out the Compress Text File project! If you have any questions or feedback, feel free to reach out.
E-mail: azizi.zahra.tehran@gmail.com