Skip to main content
net8.0

This package provides a low-level and modern .NET P/Invoke wrapper around the zlib compression library.

Published
Jul 17, 2024
2y ago
Total Downloads
605
605

Install

dotnet add package XenoAtom.Interop.zlib --version 1.0.0-alpha.2
ProductVersions
.NET
net8.0

README

XenoAtom.Interop.zlib Build Status NuGet

This package provides a low-level and modern .NET P/Invoke wrapper around the zlib compression library.

♻️ XenoAtom.Interop

This package is part of the XenoAtom.Interop project.

zlib compression library. For more information, see zlib website.

đź’» Usage

After installing the package, you can access the library through the static class XenoAtom.Interop.zlib.

For more information, see the official documentation at https://zlib.net/manual.html.

Example of using this library in C#:

using static XenoAtom.Interop.zlib;

// Compress a buffer
var data = Encoding.UTF8.GetBytes("Hello, World!");
var compressedData = new byte[32];
var ret = compress(compressedData, out var compressedSize, data);
if (ret != Z_OK)
{
    // ...
}

// Decompress a buffer
var decompressedData = new byte[32];
ret = uncompress(decompressedData, out var decompressedSize, compressedData);
if (ret != Z_OK)
{
    // ...
}

📦 Compatible Native Binaries

This library does not provide C native binaries but only P/Invoke .NET bindings to zlib 1.3.1-r1.

If the native library is already installed on your system, check the version installed. If you are using this library on Alpine Linux, see the compatible version in the Supported API section below. Other OS might require a different setup.

For convenience, you can install an existing NuGet package (outside of XenoAtom.Interop project) that is providing native binaries. The following packages were tested and are compatible with XenoAtom.Interop.zlib:

NuGet Package with Native Binaries Version
elskom.zlib.redist.win 1.2.13
elskom.zlib.redist.linux 1.2.13
elskom.zlib.redist.osx 1.2.13

📚 Supported API

This package is based on the following header version:

  • zlib C include headers: zlib-dev
  • Version: 1.3.1-r1
  • Distribution: AlpineLinux v3.20

The following API were automatically generated from the C/C++ code:

  • zlib.h: adler32, adler32_combine, adler32_z, compress, compress2, compressBound, crc32, crc32_combine, crc32_combine_gen, crc32_combine_op, crc32_z, deflate, deflateBound, deflateCopy, deflateEnd, deflateGetDictionary, deflateInit2_, deflateInit_, deflateParams, deflatePending, deflatePrime, deflateReset, deflateSetDictionary, deflateSetHeader, deflateTune, inflate, inflateBack, inflateBackEnd, inflateBackInit_, inflateCopy, inflateEnd, inflateGetDictionary, inflateGetHeader, inflateInit2_, inflateInit_, inflateMark, inflatePrime, inflateReset, inflateReset2, inflateSetDictionary, inflateSync, uncompress, uncompress2, zlibCompileFlags, zlibVersion

🪪 License

This software is released under the BSD-2-Clause license.

🤗 Author

Alexandre Mutel aka xoofx.

Changes from Previous Version

No structural changes between v1.0.0-alpha.1 and v1.0.0-alpha.2.

Adoption Assessment

A verified publisher signal is available. Assess fit from the package's supported frameworks, license and dependency graph rather than popularity alone.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.