CodeBrix.Compression.MitLicenseForever 1.0.238.89

dotnet add package CodeBrix.Compression.MitLicenseForever --version 1.0.238.89
                    
NuGet\Install-Package CodeBrix.Compression.MitLicenseForever -Version 1.0.238.89
                    
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="CodeBrix.Compression.MitLicenseForever" Version="1.0.238.89" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="CodeBrix.Compression.MitLicenseForever" Version="1.0.238.89" />
                    
Directory.Packages.props
<PackageReference Include="CodeBrix.Compression.MitLicenseForever" />
                    
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 CodeBrix.Compression.MitLicenseForever --version 1.0.238.89
                    
#r "nuget: CodeBrix.Compression.MitLicenseForever, 1.0.238.89"
                    
#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 CodeBrix.Compression.MitLicenseForever@1.0.238.89
                    
#: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=CodeBrix.Compression.MitLicenseForever&version=1.0.238.89
                    
Install as a Cake Addin
#tool nuget:?package=CodeBrix.Compression.MitLicenseForever&version=1.0.238.89
                    
Install as a Cake Tool

CodeBrix.Compression

Create, read and extract Zip, GZip, Tar and BZip2 archives using .NET; plus decompress PKWARE DCL "imploded" and LZW ".Z" data.

CodeBrix.Compression is a .NET library for working with compressed archives in multiple formats including Zip, GZip, Tar and BZip2 - and can decompress raw data in the PKWARE Data Compression Library (DCL) "imploded" format used by many MS-DOS-era installers, as well as the LZW/LZC ".Z" format written by the classic Unix compress utility. It supports encryption (AES-128 and AES-256), Zip64, and streaming operations for both creation and extraction of archives.

CodeBrix.Compression has no dependencies other than .NET, and is provided as a .NET 10 library and associated CodeBrix.Compression.MitLicenseForever NuGet package.

CodeBrix.Compression supports applications and assemblies that target Microsoft .NET version 10.0 and later. Microsoft .NET version 10.0 is a Long-Term Supported (LTS) version of .NET, and was released on Nov 11, 2025; and will be actively supported by Microsoft until Nov 14, 2028. Please update your C#/.NET code and projects to the latest LTS version of Microsoft .NET.

CodeBrix.Compression is a fork of the code of the popular SharpZipLib library version 1.4.2 - see below for licensing details.

Installation

dotnet add package CodeBrix.Compression.MitLicenseForever

Note that the NuGet package ID and the namespace are different - there is no package named plain CodeBrix.Compression:

  • NuGet package ID: CodeBrix.Compression.MitLicenseForever
  • Assembly and root namespace: CodeBrix.Compression - i.e. using CodeBrix.Compression.Zip;

The package has no NuGet dependencies and no native libraries; it depends only on the .NET base class library. XML documentation (IntelliSense) ships alongside the assembly.

CodeBrix.Compression supports:

  • Zip archives (create, read, update, extract)
  • GZip compression and decompression
  • Tar archives (create, read, extract)
  • BZip2 compression and decompression
  • DCL (PKWARE Data Compression Library "implode" format) decompression
  • LZW (.Z) decompression
  • AES-128 and AES-256 encryption for Zip archives
  • Zip64 extensions for large files
  • Streaming (non-seekable) input and output
  • In-memory archive operations
  • Checksums (CRC-32, Adler32, BZip2 CRC)
  • Many more...

Only Zip archives can be updated in place; GZip, Tar and BZip2 are create-and-extract only. DCL and LZW are decompression only. The library does not read or write RAR, 7z, XZ, Zstandard, LZ4, Snappy or Brotli, and it cannot extract Zip entries stored with the legacy Zip "Implode" (method 6) or "Shrink" (method 1) compression methods.

Sample Code

Create a Zip Archive

using CodeBrix.Compression.Zip;

using var fileStream = File.Create("archive.zip");
using var zipStream = new ZipOutputStream(fileStream);

zipStream.SetLevel(9); // 0-9, 9 being the highest level of compression

var entry = new ZipEntry("document.txt")
{
    DateTime = DateTime.Now
};

zipStream.PutNextEntry(entry);

var buffer = File.ReadAllBytes("document.txt");
zipStream.Write(buffer, 0, buffer.Length);

zipStream.CloseEntry();
zipStream.Finish();

Create an AES-Encrypted Zip Archive

using CodeBrix.Compression.Zip;

using var fileStream = File.Create("encrypted.zip");
using var zipStream = new ZipOutputStream(fileStream);

zipStream.SetLevel(9);
zipStream.Password = "my-secret-password";

var entry = new ZipEntry("confidential.txt")
{
    AESKeySize = 256, // Use AES-256 encryption
    DateTime = DateTime.Now
};

zipStream.PutNextEntry(entry);

var buffer = File.ReadAllBytes("confidential.txt");
zipStream.Write(buffer, 0, buffer.Length);

zipStream.CloseEntry();
zipStream.Finish();

Extract a Zip Archive

using CodeBrix.Compression.Zip;

using var fileStream = File.OpenRead("archive.zip");
using var zipStream = new ZipInputStream(fileStream);

ZipEntry entry;
while ((entry = zipStream.GetNextEntry()) != null)
{
    Console.WriteLine($"Extracting: {entry.Name} ({entry.Size} bytes)");

    using var outputStream = File.Create(entry.Name);
    zipStream.CopyTo(outputStream);
}

Read a Zip Archive with ZipFile

using CodeBrix.Compression.Zip;

using var zipFile = new ZipFile("archive.zip");

foreach (ZipEntry entry in zipFile)
{
    if (!entry.IsFile) continue;

    Console.WriteLine($"{entry.Name} - {entry.Size} bytes");

    using var stream = zipFile.GetInputStream(entry);
    using var reader = new StreamReader(stream);
    var content = reader.ReadToEnd();
    Console.WriteLine(content);
}

Create and Extract with FastZip

using CodeBrix.Compression.Zip;

var fastZip = new FastZip
{
    CreateEmptyDirectories = true,
    Password = "optional-password",
    EntryEncryptionMethod = ZipEncryptionMethod.AES256
};

// Create a zip from a directory
fastZip.CreateZip("backup.zip", @"C:\MyFolder", recurse: true, fileFilter: null);

// Extract a zip to a directory
fastZip.ExtractZip("backup.zip", @"C:\Extracted", fileFilter: null);

GZip Compression

using CodeBrix.Compression.GZip;

// Compress a file
GZip.Compress(File.OpenRead("data.txt"), File.Create("data.txt.gz"), isStreamOwner: true);

// Decompress a file
GZip.Decompress(File.OpenRead("data.txt.gz"), File.Create("data.txt"), isStreamOwner: true);

Tar Archive

using CodeBrix.Compression.Tar;

// Create a tar archive
using var outStream = File.Create("archive.tar");
using var tarArchive = TarArchive.CreateOutputTarArchive(outStream);

var tarEntry = TarEntry.CreateEntryFromFile("document.txt");
tarArchive.WriteEntry(tarEntry, recurse: false);

tarArchive.Close();

BZip2 Compression

using CodeBrix.Compression.BZip2;

// Compress
BZip2.Compress(File.OpenRead("data.txt"), File.Create("data.txt.bz2"), isStreamOwner: true, level: 9);

// Decompress
BZip2.Decompress(File.OpenRead("data.txt.bz2"), File.Create("data.txt"), isStreamOwner: true);

DCL (PKWARE Data Compression Library) Decompression

using CodeBrix.Compression.Dcl;

// Decompress a DCL "imploded" stream (e.g. data produced by the implode()
// function of the PKWARE Data Compression Library, common in MS-DOS-era
// installer archives). Note: this is NOT the Zip "Imploded" (method 6) format.
using var inStream = new DclInputStream(File.OpenRead("data.imploded"));
using var outStream = File.Create("data.bin");
inStream.CopyTo(outStream);

Documentation

The NuGet package includes AGENT-README.txt, a complete API reference and usage guide written for AI coding agents - point your agent at that file when it is writing code against this library.

Significant additional sample code is available in the CodeBrix.Compression.Tests project: https://github.com/ellisnet/CodeBrix.Compression/tree/main/tests/CodeBrix.Compression.Tests

Note that the test project has InternalsVisibleTo access to the library, so a few of the helpers it uses are internal and are not available to package consumers.

License

The project is licensed under the MIT License. see: https://en.wikipedia.org/wiki/MIT_License

The DCL ("implode" format) decompression code is a C# port of Mark Adler's "blast" reference decoder (zlib contrib), used under the zlib license - see THIRD-PARTY-NOTICES.txt for the full notice.

All code from SharpZipLib version 1.4.2 was licensed under the MIT License. This project (CodeBrix.Compression) complies with all provisions of the open source license of SharpZipLib version 1.4.2 (code) - and will make all modified, adapted and derived code incorporated into the CodeBrix.Compression library freely available as open source, under the same license as the SharpZipLib code license.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on CodeBrix.Compression.MitLicenseForever:

Package Downloads
CodeBrix.PdfDocuments.MitLicenseForever

CodeBrix.PdfDocuments is an Open Source .NET 10 (and higher) library that easily creates and processes PDF documents. The same drawing routines can be used to create PDF documents, draw on the screen, or send output to any printer.

CodeBrix.Platform.GameEngine.MitLicenseForever

A fully managed, cross-platform 2D and 2.5D game engine for .NET, with tile maps, sprites, layered scenes, camera/view systems, animation, physics/collision, input, audio, and SkiaSharp rendering. Includes the CodeBrix.Platform host layer.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.238.89 168 8/26/2026
1.0.198.139 633 7/17/2026
1.0.174.95 171 6/23/2026
1.0.164.1268 163 6/13/2026
1.0.117 161 4/29/2026
1.0.49 262 2/27/2026
1.0.48 147 2/26/2026