This project implements Huffman compression and decompression. It includes a web server that allows users to view compressed files through a browser. The compressed files are served by the web server, and the web interface allows them to be accessed locally.
The project is organized into the following directories:
- /src/:
bitio.py
- Handles bitwise reading and writingcompress.py
- Contains the logic to compress filesdecompress.py
- Contains the logic to decompress fileshuffman.py
- Used to create Huffman trees and encode/decode messagesutil.py
- Contains helper functions used for compression and decompressionwebserver.py
- Web server to display compressed files in a browserversion.py
- Version information for the project
README.md
- Documentation for the project
To set up the project locally:
-
Clone the repository:
git clone https://github.com/PrthD/Huffman-Compression-and-Decompression-Project.git cd Huffman-Compression-and-Decompression-Project
-
Install required dependencies: The project runs on Python 3 and does not require any external dependencies, apart from standard libraries.
-
Run the web server: Run the web server from the root of the project:
python3 src/webserver.py
The server will start, and you can view the compressed files in your browser at:
http://localhost:8000
To change the port, modify the
port
variable insrc/webserver.py
.
To compress a file, use the following command:
python3 src/compress.py yourfile.ext
Where yourfile.ext
is the name of the file you wish to compress.
To view a decompressed file, navigate to the following URL in your browser:
http://localhost:8000/yourfile.ext
The file will be displayed or downloaded depending on the file type.