Minimalistic zip/unzip library released into public domain. There is now also simple demo for creating a zip file with or without compression!
Written by Joonas Pihlajamaa (email@example.com). For details about this project, see:
The codebase is very lean and should be easy to understand, and port to any system. Compiling the example on most systems with zlib installed:
gcc -DHAVE_ZLIB junzip_demo.c junzip.c -lz -o junzip_demo
If you don't want the zlib dependency but need decompression,
Mark Adler (part of zlib contrib suite) is included and you can include it
instead of zlib:
gcc -DHAVE_PUFF junzip_demo.c junzip.c puff.c -o junzip_demo
You can also compile a "no compression" version without either above
dependencies and use
clang as well as
clang junzip_demo.c junzip.c -o junzip_demo
On Windows, MinGW requires
-mno-ms-bitfields compilation flags, so you
may want to use the supplied Makefile and build the
junzip_demo and other
utilities in one go:
You can make the zlib-enabled versions easily as well to get fast
decompression and compression support to
jzip_demo (not just store):
Or the lighter but bit slower
puff.c powered decompression without the
zlib dependency (and no compression, just store in
make_clang.bat is also provided just for laughs.
Warning, both the
junzip_demo WILL overwrite files silently!
Zip demo assumes last parameter is the target and overwrites that file, and
unzip demo overwrites any files already within the directory with contents of the zip. Be careful!
junzip_demo file.zipunzips the
jzip_demo file1 file2 output.zipcreates a zip file
junzip_dump file.zipdumps the headers in
junzip_testchecks if structures are the right size