IronCompress 1.2.4

.NET 6.0 .NET Core 3.1 .NET Standard 2.1
dotnet add package IronCompress --version 1.2.4
NuGet\Install-Package IronCompress -Version 1.2.4
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="IronCompress" Version="1.2.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add IronCompress --version 1.2.4
#r "nuget: IronCompress, 1.2.4"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install IronCompress as a Cake Addin
#addin nuget:?package=IronCompress&version=1.2.4

// Install IronCompress as a Cake Tool
#tool nuget:?package=IronCompress&version=1.2.4

IronCompress

NuGet

<img src="icon.png" width=80 height=80 align="left"/> C++ compression methods joined together in one native library, cross-compiled for multiple architectures and exposed as a .NET library. .NET has built-in support for Gzip and Brotli (which is what this library is using) but other compression methods are either available only as native libraries hard (impossible for some) to consume, or ill-ported C# alternatives. In fact, I myself wrote one of them. Using native, original implementations is the way to go if you want to keep performance, security, and features up to date.

The library supports the following formats:

And following architectures:

Windows Linux Mac OSX
x64
x32
ARM coming soon

The library periodically updates to the latest binaries. All the binaries are compiled from C/C++ source with CMake for major systems i.e. Linux, Windows and Mac OSX. They are then wrapped safely with a .NET interface.

Using

This library only compresses buffers. It may work with streams in the future, but I am currently only interested in buffers. Essentially, you pass ReadOnlySpan<byte> as an input, and receive Span<T> as an output in the most efficient way.

Here is an example of how to compress buffer with snappy codec:

using IronCompress;	// root namespace

// Construct library entry point and optionally pass an implementation of ArrayPool.
// I will pass default shared pool here.
var iron = new Iron(ArrayPool<byte>.Shared);

byte[] input = ...;
using(Result compressed = iron.Compress(Codec.Snappy, input.AsSpan()))
{
    // ... use data
}

Compressand Decompress methods actually return a Result class which wraps byte array of compression or decompression operation. You can access the underlying result by calling to .AsSpan() method inside the result. On dispose, Result makes sure the underlying memory is freed up - if pooling was used, it will be returned back to the pool.

To decompress:

using (Result uncompressed = iron.Decompress(Codec.Snappy, compressed, input.Length))
{
	// ... use data
}

As with compression, this returns Result with decompressed data. It's worth nothing one important difference - decompression needs the length of output buffer specified as third parameter (input.Length). Although some decompressors can guess uncompressed length more or less correct, the others won't know it beforehand. In reality this problem is solved by using a framing format that adds metadata about resulting length, however many compression formats do not define that and consider compressed packets to be implementation specific.

You will need more or less recent C++ compiler, CMake and .NET SDK 6 to build the code.

Building

See workflow file for building instructions.

Hint: To develop managed only code locally you can download the latest artifact from Actions output and put it into native/ubin so you have binaries for all platforms.

Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.1
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • No dependencies.
  • .NETStandard 2.1

    • No dependencies.
  • net6.0

    • No dependencies.

NuGet packages (1)

Showing the top 1 NuGet packages that depend on IronCompress:

Package Downloads
Parquet.Net

Pure managed .NET library to read and write Apache Parquet files, targeting .NET Standand 2.0 and up. Linux, Windows and Mac are first class citizens, but also works everywhere .NET is running (Android, iOS, IOT). Has zero dependencies on third-party libraries or any native code. Provides both low-level access to Apache Parquet files, and high-level utilities for more traditional and humanly understandable row-based access. Includes automatic serializer/deserializer from C# classes into parquet files that works by generating MSIL (bytecode) on the fly and is therefore super fast.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on IronCompress:

Repository Stars
aloneguid/parquet-dotnet
Fully managed Apache Parquet implementation
Version Downloads Last updated
1.2.4 378 11/24/2022
1.2.3 4,331 11/10/2022
1.2.2 81 11/10/2022
1.2.0 101 11/9/2022
1.1.5 13,292 10/13/2022
1.1.4 135 10/12/2022
1.1.3 135 10/12/2022
1.1.2 133 10/12/2022
1.1.1 134 10/12/2022
1.1.0 135 10/11/2022
1.0.0 135 9/26/2022
1.0.0-preview-03 43 9/26/2022
1.0.0-preview-02 141 1/12/2022
1.0.0-preview-01 113 1/12/2022