{"id":27275204,"url":"https://github.com/ayush272002/huffzip","last_synced_at":"2025-10-06T18:57:59.047Z","repository":{"id":286491726,"uuid":"961559882","full_name":"Ayush272002/HuffZip","owner":"Ayush272002","description":"HuffZip is a simple, command-line tool for compressing and decompressing files using the Huffman Coding algorithm. Built in C, it's a great example of how lossless compression works under the hood.","archived":false,"fork":false,"pushed_at":"2025-04-06T19:16:22.000Z","size":9,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-06T20:25:19.869Z","etag":null,"topics":["c","huffman-compression-algorithm","minheap"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Ayush272002.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-06T19:02:04.000Z","updated_at":"2025-04-06T19:17:18.000Z","dependencies_parsed_at":"2025-04-06T20:35:32.338Z","dependency_job_id":null,"html_url":"https://github.com/Ayush272002/HuffZip","commit_stats":null,"previous_names":["ayush272002/huffzip"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ayush272002%2FHuffZip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ayush272002%2FHuffZip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ayush272002%2FHuffZip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Ayush272002%2FHuffZip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Ayush272002","download_url":"https://codeload.github.com/Ayush272002/HuffZip/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248433687,"owners_count":21102640,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c","huffman-compression-algorithm","minheap"],"created_at":"2025-04-11T15:47:52.862Z","updated_at":"2025-10-06T18:57:54.010Z","avatar_url":"https://github.com/Ayush272002.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# **HuffZip**\n\n#### Description:\n\nThis project implements a file compression and decompression utility using the **Huffman Coding** algorithm. It allows users to compress and decompress text files by building a Huffman tree, generating Huffman codes, and then storing the compressed file. Additionally, the project provides a mechanism to handle file frequencies, which are necessary for decompression.\n\nThe program consists of several modules:\n\n- **Huffman coding** for compressing and decompressing text files.\n- **Min-heap data structure** used to build the Huffman tree.\n- **File handling** for reading and writing files.\n- **Compression and decompression utilities** for file operations.\n\n#### Features:\n\n- **Compression**: Compress text files using Huffman coding.\n- **Decompression**: Decompress files that were compressed using this algorithm, utilizing the frequencies of characters stored in a separate file.\n- **Memory Management**: Efficient memory handling for the Huffman tree.\n- **Flexible File Operations**: Handle files with different character sets and manage compression and decompression output.\n\n#### Installation:\n\n1. Clone this repository:\n\n   ```bash\n   https://github.com/Ayush272002/HuffZip.git\n   cd HuffZip\n   ```\n\n2. Build the project using `make`:\n\n   ```bash\n   make\n   ```\n\n3. Once built, the executable `huffman_compression` will be located in the `build` directory.\n\n#### Usage:\n\n1. **Compression**:\n   To compress a file, run the following command:\n\n   ```bash\n   ./build/huffman_compression compress \u003cinput_file\u003e \u003coutput_file\u003e\n   ```\n\n   This will compress the input file and save the compressed output to the output file.\n\n2. **Decompression**:\n   To decompress a file, you will need the frequencies file (`frequencies.bin`) generated during compression:\n   ```bash\n   ./build/huffman_compression decompress \u003cinput_file\u003e \u003coutput_file\u003e\n   ```\n   This will decompress the input file and save the result in the output file.\n\n#### Makefile Commands:\n\n- **Build**: `make`  \n   Compiles the source files and generates the executable `huffman_compression` in the `build` directory.\n\n- **Clean**: `make clean`  \n   Removes object files and the executable from the `build` directory.\n\n- **Run**: `make run`  \n   Builds the project and runs the executable for testing purposes.\n\n- **Debug**: `make debug`  \n   Builds the project with debugging symbols, which can be helpful for tracing issues during development.\n\n#### File Structure:\n\n```\n/huffman-compression\n├── /src                  # Source code files\n│   ├── main.c            # Main program entry point\n│   ├── huffman.c         # Huffman coding and tree construction\n│   ├── minheap.c         # Min-heap data structure for Huffman tree\n│   └── file_handler.c    # File handling operations for reading and writing\n├── /include              # Header files\n│   ├── huffman.h         # Declarations for Huffman coding\n│   ├── minheap.h         # Declarations for min-heap data structure\n│   └── file_handler.h    # Declarations for file operations\n├── /build                # Build directory (created on `make`)\n├── Makefile              # Makefile to automate building and cleaning\n└── README.md             # Project README\n```\n\n#### Example Workflow:\n\n1. **Compress a file**:\n\n   ```bash\n   ./build/huffman_compression compress test.txt test_compressed.txt\n   ```\n\n2. **Decompress the file**:\n\n   ```bash\n   ./build/huffman_compression decompress test_compressed.txt decompressed.txt\n   ```\n\n3. **Check the content of the decompressed file** to verify if the process worked as expected.\n\n#### Troubleshooting:\n\n- If you encounter a **segmentation fault** or other issues, ensure that your input file is correctly formatted and does not contain unexpected characters. Additionally, debug with `make debug` to help track down memory issues.\n- **Missing Huffman Codes**: If the program complains about missing Huffman codes for certain characters during compression, make sure all characters in the input file are handled properly by the `generateCodes` function.\n\n#### Contributing:\n\nFeel free to contribute to this project by forking the repository and submitting a pull request. If you find any bugs or have ideas for improvements, don't hesitate to open an issue!\n\n#### License:\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayush272002%2Fhuffzip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fayush272002%2Fhuffzip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fayush272002%2Fhuffzip/lists"}