A fast command-line file compressor and decompressor written in C, powered by raylib's built-in CompressData / DecompressData functions (DEFLATE via miniz).
$ ./compress myfile.txt
file size: 2048
data compressed
→ myfile.txt.zip
$ ./compress -d myfile.txt.zip
file size: 512
data decompressed
→ myfile.txt.zip.zip
- lossless DEFLATE compression via raylib/miniz
- single-file C source — easy to read and modify
- compress any binary or text file
- decompress with a single
-dflag - no external dependencies beyond raylib
requirements: gcc, raylib installed on your system
# clone
git clone https://github.com/YOUR_USERNAME/file_compressor.git
cd file_compressor
# compile
gcc main.c -o compress -lraylib -lm
# or with make
make# ubuntu / debian
sudo apt install libraylib-dev
# arch
sudo pacman -S raylib
# macOS
brew install raylib
# windows (via vcpkg)
vcpkg install raylib# compress a file → produces <filename>.zip
./compress <file>
# decompress a file
./compress -d <file>./compress photo.png # → photo.png.zip
./compress archive.tar # → archive.tar.zip
./compress -d photo.png.zip # → photo.png.zip.zipnote: the output always appends
.zipto the input filename. when decompressing, make sure to pass the.zipfile as the argument.
- opens the input file in binary mode and reads it fully into memory
- calls raylib's
CompressData(compress) orDecompressData(decompress) - writes the result to
<input_filename>.zip - frees memory with raylib's
MemFree
raylib uses miniz under the hood — a single-file DEFLATE implementation compatible with zlib and the ZIP format.
file_compressor/
├── main.c ← all source code
├── Makefile ← build rules
├── .gitignore ← ignores binary output
└── README.md
- output filename is always
<input>.zip— no custom output path yet - entire file is loaded into memory before compression (not streaming)
- no compression level control
MIT — see LICENSE