{"id":1512,"library":"inflate64","title":"inflate64 compression/decompression","description":"A Python library providing deflate64 compression and decompression functionality. It leverages the zlib-ng library for efficient performance and natively supports the larger dictionary sizes (up to 64KB) characteristic of deflate64, which can be beneficial for highly repetitive large files. The current version is 1.0.4. Releases are infrequent, typically for minor fixes or updates.","status":"active","version":"1.0.4","language":"en","source_language":"en","source_url":"https://github.com/miurahr/inflate64","tags":["compression","decompression","deflate64","zlib-ng","binary data"],"install":[{"cmd":"pip install inflate64","lang":"bash","label":"Install latest version"}],"dependencies":[],"imports":[{"note":"Functions are directly available via the top-level inflate64 module.","symbol":"inflate","correct":"import inflate64; inflate64.inflate"},{"note":"Functions are directly available via the top-level inflate64 module.","symbol":"deflate","correct":"import inflate64; inflate64.deflate"}],"quickstart":{"code":"import inflate64\n\noriginal_data = b\"This is some data to be compressed using deflate64. It's important to remember that deflate64 allows for larger dictionary sizes, which can be beneficial for highly repetitive large files. \" * 100\n\n# Compress data using deflate64\ncompressed_data = inflate64.deflate(original_data, level=9)\nprint(f\"Original size: {len(original_data)} bytes\")\nprint(f\"Compressed size: {len(compressed_data)} bytes\")\n\n# Decompress data using inflate64\n# The max_buffer_size is crucial for inflate to prevent errors on large inputs.\n# Setting it to 0 attempts auto-sizing, but providing a safe upper bound is often better.\n# Here we give some headroom (e.g., original size * 2).\ndecompressed_data = inflate64.inflate(compressed_data, max_buffer_size=len(original_data) * 2)\n\nassert original_data == decompressed_data\nprint(\"Decompression successful!\")\n","lang":"python","description":"Demonstrates basic compression and decompression of a byte string using `inflate64.deflate` and `inflate64.inflate`. The `max_buffer_size` parameter in `inflate` is highlighted as a critical consideration for robust decompression."},"warnings":[{"fix":"Always provide a `max_buffer_size` to `inflate64.inflate` that is at least as large as the expected decompressed data. For unknown sizes, use a generous estimate or set to 0 and implement robust error handling to catch `inflate64.error`.","message":"The `inflate64.inflate` function requires a `max_buffer_size` argument. If the actual decompressed data size exceeds this value, an `inflate64.error` will be raised. A value of 0 attempts to auto-size but may not be suitable for all scenarios, especially with potentially malicious or malformed compressed data.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Understand that the library handles the deflate64-specific dictionary size implicitly. Use `wbits=15` for standard zlib streams, `-15` for raw deflate streams, or `31` for gzip streams, as you would with a standard `zlib` library.","message":"While `inflate64` implements the deflate64 standard (with larger dictionary sizes), the `wbits` parameter for both `deflate` and `inflate` functions behaves similarly to standard `zlib`. This parameter primarily controls the presence and type of header/footer (raw deflate, zlib, or gzip), rather than directly configuring the deflate64 window size.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If `pip install inflate64` fails with compilation errors, ensure you have the necessary C compiler tools installed on your system. For Windows, install 'Build Tools for Visual Studio'; for Debian/Ubuntu, `sudo apt-get install build-essential`.","message":"This library is a C extension and may require C build tools (like `gcc` on Linux/macOS or MSVC on Windows) for installation if a pre-built wheel is not available for your specific Python version and operating system. This is a common requirement for Python packages wrapping native libraries.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}