No description
Find a file
2026-04-24 22:49:28 -07:00
.github Build libc++ with MSAN instrumentation for gtest_minizip 2026-04-22 20:59:10 -07:00
cmake Harden the cmake Address Sanitizer detection code. (#960) 2026-04-22 18:56:59 -07:00
compat Fix modified_date when zipping 2025-12-24 14:58:22 -08:00
doc Update markdown files to reference PPMD compression (#958) 2026-02-04 17:08:35 -05:00
test Build libc++ with MSAN instrumentation for gtest_minizip 2026-04-22 20:59:10 -07:00
.clang-format Adopting a clang-format based on Google style 2024-11-01 16:13:37 -07:00
.codecov.yaml Added code coverage yaml configuration. 2023-01-15 10:43:41 -08:00
.gitignore cmake: generate mz_config.h in build directory 2026-04-24 22:01:02 -07:00
CMakeLists.txt cmake: remove duplicate source include dir 2026-04-24 22:49:28 -07:00
INDEX.md Update markdown files to reference PPMD compression (#958) 2026-02-04 17:08:35 -05:00
LICENSE minor URL correction, remove EOL spaces, add EOF newlines. 2019-09-15 20:11:28 +00:00
minigzip.c Apply Clang format 2025-03-23 14:09:01 -07:00
minizip.c Refactor file rename error handling when backup fails 2026-03-11 11:21:20 -07:00
minizip.pc.cmakein Fix pkgconfig file for private dependencies 2023-09-12 12:05:12 -07:00
mz.h Version 4.1.1. 2026-04-22 21:10:20 -07:00
mz_config.h.cmakein cmake: improve: mz.h, mz_os.h are public API, shouldn't rely on user -D (#978) 2026-04-20 17:26:22 -07:00
mz_crypt.c fix missing const at r/o buffers 2025-09-15 13:42:22 -07:00
mz_crypt.h fix missing const at r/o buffers 2025-09-15 13:42:22 -07:00
mz_crypt_apple.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_crypt_openssl.c Align structures for 64-bit platforms (stream_split, mz_opt, crypt_sha, crypt_hmac) 2025-03-11 19:42:25 -07:00
mz_crypt_winvista.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_crypt_winxp.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_os.c Allocate symlink buffers on first use 2026-01-30 10:03:21 -08:00
mz_os.h cmake: improve: mz.h, mz_os.h are public API, shouldn't rely on user -D (#978) 2026-04-20 17:26:22 -07:00
mz_os_posix.c cmake: improve: mz.h, mz_os.h are public API, shouldn't rely on user -D (#978) 2026-04-20 17:26:22 -07:00
mz_os_win32.c Add MOVEFILE_COPY_ALLOWED flag to MoveFileExW to allow moving across volumes 2026-03-11 11:18:41 -07:00
mz_strm.c refactor: passing reader, writer, zip instead of handle 2025-06-17 09:07:54 -07:00
mz_strm.h zstd: add MZ_STREAM_PROP_COMPRESS_THREADS 2025-06-16 15:05:52 -07:00
mz_strm_buf.c Remove excess checks before free() 2025-03-05 10:26:44 -08:00
mz_strm_buf.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_bzip.c align bzip and lzma streams for 64-bit platforms 2025-05-20 10:02:36 -04:00
mz_strm_bzip.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_libcomp.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_libcomp.h fix #915: headers should not include there dependencies 2025-11-10 18:37:32 -08:00
mz_strm_lzma.c align bzip and lzma streams for 64-bit platforms 2025-05-20 10:02:36 -04:00
mz_strm_lzma.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_mem.c Fix allocating negative size 2025-10-30 16:49:22 -07:00
mz_strm_mem.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_os.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_os_posix.c cmake: improve: mz.h, mz_os.h are public API, shouldn't rely on user -D (#978) 2026-04-20 17:26:22 -07:00
mz_strm_os_win32.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_pkcrypt.c Remove excess checks before free() 2025-03-05 10:26:44 -08:00
mz_strm_pkcrypt.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_ppmd.c Fix two bugs causing premature exiting the PPMd decompression (#976) 2026-04-23 01:43:03 +00:00
mz_strm_ppmd.h Add support for PPMd compression 2026-01-30 10:03:22 -08:00
mz_strm_split.c Fix integer overflow in split stream write for disk sizes > 2GB 2026-03-12 19:14:32 -07:00
mz_strm_split.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_wzaes.c Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_wzaes.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_zlib.c Remove excess checks before free() 2025-03-05 10:26:44 -08:00
mz_strm_zlib.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_strm_zstd.c mz_stream_zstd_set_prop_int64: Implicit conversion loses integer precision 2025-10-30 16:49:02 -07:00
mz_strm_zstd.h Clang-format style changes. 2024-11-01 16:37:57 -07:00
mz_zip.c Document that mz_zip_tm_to_time_t requires a year-1900 indexed time struct. (#951) 2026-02-02 22:19:56 -05:00
mz_zip.h Document that mz_zip_tm_to_time_t requires a year-1900 indexed time struct. (#951) 2026-02-02 22:19:56 -05:00
mz_zip_rw.c Add support for PPMd compression 2026-01-30 10:03:22 -08:00
mz_zip_rw.h fix improper mz_stream mode set in mz_zip_reader_entry_save_buffer() 2025-09-15 13:42:22 -07:00
README.md Set default value for MZ_SANITIZER to OFF in README.md 2026-03-11 19:18:34 -07:00

minizip-ng

minizip-ng is a zip manipulation library written in C that is supported on Windows, macOS, and Linux.

Master Branch Status Fuzzing Status License: Zlib codecov.io Packaging status

Developed and maintained by Nathan Moinvaziri.

Branches

Name Description
develop Latest development code.
master Most recent stable release.
1.2 Old changes to original minizip that includes WinZip AES encryption, disk splitting, I/O buffering and some additional fixes. Not ABI compatible with original minizip.
1.1 Original minizip as of zlib 1.2.11.

History

Minizip was originally developed by Gilles Vollant in 1998. It was first included in the zlib distribution as an additional code contribution starting in zlib 1.1.2. Since that time, it has been continually improved upon and contributed to by many people. The original project can still be found in the zlib distribution that is maintained by Mark Adler.

The motivation behind this repository has been the need for new features and bug fixes to the original library which had not been maintained for a long period of time. The code has been largely refactored and rewritten in order to help improve maintainability and readability. A compatibility layer has been provided for consumers of the original minizip library.

Features

  • Creating and extracting zip archives.
  • Adding and removing entries from zip archives.
  • Read and write raw zip entry data.
  • Reading and writing zip archives from memory.
  • Support for large files with ZIP64 extension.
  • Zlib, BZIP2, LZMA, PPMD, XZ and ZSTD compression methods.
  • Password protection through Traditional PKWARE and WinZIP AES encryption.
  • Buffered streaming for improved I/O performance.
  • NTFS timestamp support for UTC last modified, last accessed, and creation dates.
  • Disk split support for splitting zip archives into multiple files.
  • Preservation of file attributes across file systems.
  • Follow and store symbolic links.
  • Unicode filename support through UTF-8 encoding.
  • Legacy character encoding support CP437, CP932, CP936, CP950.
  • Turn off compilation of compression, decompression, or encryption.
  • Windows (Win32 & WinRT), macOS and Linux platform support.
  • Streaming interface for easy implementation of additional platforms.
  • Support for Apple's compression library ZLIB and XZ implementations.
  • Zero out local file header information.
  • Zip/unzip of central directory to reduce size.
  • Recover the central directory if it is corrupt or missing.
  • Example minizip and minigzip command line tools.

Build

To generate project files for your platform:

  1. Download and install cmake (version 3.11 or later recommended).
  2. Run cmake in the minizip directory.
cmake -S . -B build -D MZ_BUILD_TESTS=ON
cmake --build build

Build Options

Name Description Default Value
MZ_COMPAT Enables compatibility layer ON
MZ_ZLIB Enables ZLIB compression ON
MZ_ZLIB_FLAVOR Select ZLIB implementation (auto, zlib-ng, zlib) auto
MZ_BZIP2 Enables BZIP2 compression ON
MZ_LZMA Enables LZMA & XZ compression ON
MZ_PPMD Enables PPMD compression ON
MZ_ZSTD Enables ZSTD compression ON
MZ_LIBCOMP Enables Apple compression APPLE
MZ_FETCH_LIBS Enables fetching third-party libraries if not found WIN32
MZ_FORCE_FETCH_LIBS Enables fetching third-party libraries always OFF
MZ_PKCRYPT Enables PKWARE traditional encryption ON
MZ_WZAES Enables WinZIP AES encryption ON
MZ_OPENSSL Enables OpenSSL encryption UNIX
MZ_LIBBSD Builds with libbsd crypto random UNIX
MZ_ICONV Enables iconv encoding conversion ON
MZ_COMPRESS_ONLY Only support compression OFF
MZ_DECOMPRESS_ONLY Only support decompression OFF
MZ_FILE32_API Builds using posix 32-bit file api OFF
MZ_BUILD_TESTS Builds minizip test executable OFF
MZ_BUILD_UNIT_TESTS Builds minizip unit test project OFF
MZ_BUILD_FUZZ_TESTS Builds minizip fuzz executables OFF
MZ_CODE_COVERAGE Build with code coverage flags OFF
MZ_SANITIZER Build with code sanitizer (Memory, Thread, Address, Undefined) OFF
MZ_LIB_SUFFIX Library name suffix for packaging

Third-Party Libraries

Third-party libraries may be required based on the CMake options selected. If the system already has the library installed then it will be used, otherwise CMake will retrieve the source code for the library from its official git repository and compile it in when the MZ_FETCH_LIBS option is enabled.

Project License CMake Option Comments
bzip2 license MZ_BZIP2 Written by Julian Seward.
liblzma Public domain MZ_LZMA Written by Igor Pavlov and Lasse Collin.
ppmd Public domain MZ_PPMD Written by Igor Pavlov.
zlib zlib MZ_ZLIB Written by Mark Adler and Jean-loup Gailly. Or alternatively, zlib-ng by Hans Kristian Rosbach.
zstd BSD MZ_ZSTD Written by Facebook.

This project uses the zlib license.

Acknowledgments

Thanks go out to all the people who have taken the time to contribute code reviews, testing and/or patches. This project would not have been as good without you.

Thanks to Gilles Vollant on which this work is originally based on.

The ZIP format was defined by Phil Katz of PKWARE.