Universal.Common.IO.Compression 1.2.1

dotnet add package Universal.Common.IO.Compression --version 1.2.1
                    
NuGet\Install-Package Universal.Common.IO.Compression -Version 1.2.1
                    
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="Universal.Common.IO.Compression" Version="1.2.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Universal.Common.IO.Compression" Version="1.2.1" />
                    
Directory.Packages.props
<PackageReference Include="Universal.Common.IO.Compression" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Universal.Common.IO.Compression --version 1.2.1
                    
#r "nuget: Universal.Common.IO.Compression, 1.2.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Universal.Common.IO.Compression@1.2.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Universal.Common.IO.Compression&version=1.2.1
                    
Install as a Cake Addin
#tool nuget:?package=Universal.Common.IO.Compression&version=1.2.1
                    
Install as a Cake Tool

Universal.Common.IO.Compression

Compression codecs with no third-party package dependencies: Deflate, Gzip, Zlib, LZ4, LZMA (classic and Unity-header variants), and Zstandard.

Self-describing formats implement ICompressionAlgorithm. Deflate, Gzip, and Zlib also implement IStreamingCompressionAlgorithm. Raw LZ4 blocks implement ISizedCompressionAlgorithm because their uncompressed size is supplied separately.

Quickstart

// LZ4 (ISizedCompressionAlgorithm - raw block format needs the original size to decompress)
Lz4CompressionAlgorithm lz4 = new Lz4CompressionAlgorithm();
byte[] lz4Compressed = lz4.Compress(data);
byte[] lz4Restored = lz4.Decompress(lz4Compressed, data.Length);

// LZMA, Zstandard, Deflate, Gzip, Zlib
LzmaCompressionAlgorithm lzma = new LzmaCompressionAlgorithm();
byte[] lzmaCompressed = lzma.Compress(data);
byte[] lzmaRestored = lzma.Decompress(lzmaCompressed);

ZstdCompressionAlgorithm zstd = new ZstdCompressionAlgorithm();
byte[] restored2 = zstd.Decompress(zstdCompressedBytes);

IStreamingCompressionAlgorithm zlib = new ZlibCompressionAlgorithm();
using Stream decompressor = zlib.CreateDecompressionStream(compressedInput);
decompressor.CopyTo(output);
// For zlib, compressedInput is now positioned immediately after this member.

// Limit decompression to one member embedded in a larger stream.
using Stream member = zlib.CreateDecompressionStream(container, compressedLength, leaveOpen: true);
await member.CopyToAsync(output);

// End-to-end asynchronous helpers are available for every streaming codec.
await zlib.CompressAsync(input, compressedOutput, cancellationToken);
await zlib.DecompressAsync(compressedInput, output, cancellationToken);

Status

  • LZ4, LZMA (+ Unity's own header variant): full encode and decode, verified byte-for-byte in both directions against independent real-world implementations (lz4js, Python's lzma module).
  • Zstandard: full decoder (frame/block parsing, FSE with predefined or custom tables, Huffman-coded literals, sequence execution) - verified against real Zstandard-compressed data, including actual Figma-exported .fig files. The encoder currently emits valid, standards-compliant frames using Raw/RLE blocks only (real data any conforming decoder reads correctly, just not entropy-coded) - full FSE/Huffman encoding is its own follow-up.
  • Deflate, Gzip, Zlib: synchronous and asynchronous streaming encode and decode. Zlib validates its header and Adler-32 checksum, supports non-seekable inputs, and leaves following members or container data unread.
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Universal.Common.IO.Compression:

Package Downloads
Universal.Common.Formats.Fig

Reads and writes Figma .fig file containers and their Kiwi-encoded document data.

Universal.Meta.WhatsApp.Client

WebSocket client for the WhatsApp multi-device protocol.

Universal.Git

A Git-compatible repository implementation built on Universal.VersionControl.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.2.1 61 9/8/2026
1.1.0 453 8/19/2026
1.0.0 296 8/14/2026

Added bounded compressed-member streams and asynchronous streaming APIs. Zlib now stops at exact member boundaries, preserves following input, supports asynchronous I/O, accepts SmallestSize on newer runtimes, and retains header and Adler-32 validation.