kuba--/zip logo

kuba--/zip

Free

A portable, simple zip library written in C

FreeFree tier
Type
Open Source

About kuba--/zip

A portable, simple zip library written in C, built on top of the miniz v3.1.2 library. It provides a lightweight and easy-to-integrate solution for creating, reading, appending, and extracting ZIP archives. The library is designed to be minimal – requiring only three source files – and supports on-the-fly compression, merging multiple files into a single entry, and extraction to either a folder or memory buffer. It is cross-platform, running on OSX, Linux, Windows, Android, and iOS, making it suitable for embedded systems, mobile apps, and desktop software that need basic ZIP functionality without heavy dependencies.

Key Features

Cross-platform support (OSX, Linux, Windows, Android, iOS)
Simple API: create, open, append, extract ZIP archives
On-the-fly compression and merging of multiple files into one entry
Extract entire archive to a folder with a callback
Extract individual entries to memory buffers
Tiny footprint – requires only three source files (zip.h, zip.c, miniz.c)
Based on the proven miniz v3.1.2 compression library
Supports both file and memory streams for input/output

Pros & Cons

Pros
  • Portable across major OS and mobile platforms
  • Simple API requiring only a few function calls to perform common operations
  • Tiny footprint – just three source files to compile and integrate
  • On-the-fly compression and merging of multiple files, saving memory
  • Supports both file and memory buffers for input and output
Cons
  • Requires manual memory management (typical of C libraries)
  • Limited to ZIP compression format (no support for other archive formats)
  • Documentation is limited to README examples and API comments

Best For

Embedding ZIP functionality in C/C++ projects without heavy dependenciesCreating lightweight cross-platform file compression toolsBuilding archive extraction features for embedded or mobile applicationsMerging multiple log files or data buffers into a single compressed archive

FAQ

What is the license for this library?
It is licensed under the MIT License.
What platforms does zip support?
It supports macOS, Linux, Windows, Android, and iOS.
How many source files do I need to include in my project?
You only need to include three files: zip.h, zip.c, and miniz.c.
Can I append to an existing ZIP archive?
Yes, you can open an existing archive in append mode ('a') using zip_open and add new entries.
Does the library support extracting entries to memory?
Yes, you can extract a zip entry into a memory buffer using zip_entry_read, either with automatic allocation or with a pre-allocated buffer.