Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 

Repository files navigation

fileCompressor 🗜️

A lightweight Python utility to compress files and display size statistics, giving you quick insights into storage efficiency.


🚀 Features

  • Compress any file using a built-in compression algorithm.
  • Display original vs. compressed file size, along with size reduction percentage.
  • Easy command-line usage with clear prompts.
  • No external dependencies—pure Python implementation. ([github.com][1], [github.com][2], [github.com][3])

🛠️ How It Works

  • Reads the given file in binary mode.

  • Applies compression logic (e.g., zlib-based or custom algorithm).

  • Writes the compressed output to a new file (e.g., with .compressed suffix).

  • Calculates and prints:

    • Original size
    • Compressed size
    • Compression ratio and percentage savings

📦 Setup & Installation

  1. Clone the repo:

    git clone https://github.com/sagnikdatta2k6/fileCompressor.git
    cd fileCompressor
  2. (Optional) Create a virtual environment:

    python3 -m venv venv
    source venv/bin/activate  # Windows: venv\Scripts\activate
  3. Install dependencies: (if any are specified in requirements.txt—if not, skip this step)

    pip install -r requirements.txt

⚙️ Usage

Run the compressor with:

python file_conv.py <input_file> [<output_file>]
  • <input_file>: The file you want to compress.
  • [<output_file>]: (Optional) Specify output filename. Default will append .compressed.

Example:

python file_conv.py large_video.mp4 compressed_video.mp4

After execution, you'll see output like:

Original size: 100 MB
Compressed size: 60 MB
You saved 40%!

📈 Why Use This?

  • Quickly assess how much space compression saves for different file types.
  • Lightweight CLI tool perfect for scripting or educational purposes.
  • No external libs—run it anywhere Python is available.

✅ Limitations & TODOs

  • No decompression support yet.

  • Uses basic compression—may not match optimized tools like gzip or zip.

  • No GUI or batch mode.

  • Possible improvements:

    • Add decompression functionality.
    • Explore advanced compression (e.g., gzip, bz2).
    • Add batch processing or directory support.
    • Include unit tests and CI integration.

🤝 Contributing

Contributions and feedback are welcome! Here’s how to help:

  1. Fork the repo

  2. Create a feature branch:

    git checkout -b feature/add-decompressor
  3. Make your changes (and tests if applicable)

  4. Open a Pull Request with a detailed description of your changes


📄 License

This project is released under the MIT License—see the LICENSE file for details.


🙏 Acknowledgments

Thanks to open-source practitioners who build tools like this and inspire Python utilities everywhere!

About

fileCompressor is a Python-based tool to compress and decompress files efficiently using the zlib library. It provides a simple CLI for reducing file sizes without quality loss, making it useful for storage optimization and faster file sharing.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages