miniz Documentation

repository·master·Indexed 25 days ago

https://github.com/richgel999/miniz

A high-performance, single-file C library for lossless data compression implementing zlib and Deflate standards. It provides utilities for ZIP archive manipulation, PNG writing, and low-level codecs (tdefl and tinfl) that do not use the heap. Miniz serves as a drop-in replacement for many zlib APIs and is distributed as a single source and header file under the MIT license.

Tokens
511
Snippets
1
Records
4
Agent score
34%

What's inside miniz

  1. Overview of miniz features and capabilities

    master

    Miniz is a high-performance, lossless data compression library written in plain C. Key features include:

    • Standards Compliance: Implements zlib (RFC 1950) and Deflate (RFC 1951) specifications.
    • API Compatibility: Serves as a drop-in replacement for many commonly used zlib APIs.
    • Format Support: Includes functions for writing .PNG files and a set of APIs for reading, writing, and appending .ZIP archives.
    • Stream Processing: Supports stream-based processing via a coroutine-style implementation (not block-based). The zlib-style API functions can be called one byte at a time.
    • Low-level Codecs: Provides tdefl (compressor) and tinfl (decompressor) with simple state structs that can be saved/restored using memcpy. These low-level APIs do not use the heap.
    • Portability: Single source and header file library; tested with GCC, clang, and Visual Studio.
    • Licensing: MIT licensed (independent of zlib's licensing).
  2. Integrate miniz into your project

    master

    Miniz can be integrated into your project in two primary ways:

    1. Manual Integration: Download the miniz.c and miniz.h files from the releases page and add them directly to your source tree. These files are amalgamated from the library's source files.
    2. Build System Integration: Use miniz as a module within CMake, Meson, or your preferred build system.
  3. Install miniz using vcpkg

    master

    You can install miniz using the vcpkg dependency manager by following these commands:

    git clone https://github.com/Microsoft/vcpkg.git
    cd vcpkg
    ./bootstrap-vcpkg.sh
    ./vcpkg integrate install
    ./vcpkg install miniz
  4. Known limitations of miniz

    master

    When using miniz, be aware of the following:

    • No Encryption: The library does not support encrypted archives.
    • Documentation: Documentation is minimal; it is assumed users are already familiar with the basic zlib API. Key comments are provided before enums and APIs in the source code.