Recursive AI

SharpCompress alternative for C# archives

OneArchive is a SharpCompress alternative for C# archives when you need ISO 9660, CAB input, or Deflate64 ZIP output. Compare ZIP, 7z, CAB, ISO, and RAR.

OneArchive is a free, open-source archive and compression library for .NET from Recursive AI, licensed MIT or Apache-2.0. NuGet · GitHub

dotnet add package RecursiveAI.OneArchive --version 1.2.0
dotnet add package SharpCompress --version 0.50.12

Use OneArchive for ISO 9660, CAB input, or writing Deflate64 ZIPs; keep SharpCompress if you need to extract compressed RAR entries.

SharpCompress is only in this .NET 10 sample to prove another library can read the Deflate64 ZIP OneArchive writes; it’s not a OneArchive dependency. In a .NET 10 console project with both packages installed, replace Program.cs and run dotnet run.

Program.cs.NET 10
using RecursiveAI.OneArchive;
using RecursiveAI.OneArchive.Zip;
using SharpCompress.Archives.Zip;
 
using var zip = new MemoryStream();
var options = new ZipWriterOptions { Method = ZipMethod.Deflate64 };
using (var writer = new ZipWriter(zip, options, leaveOpen: true))
{
    using var input = new MemoryStream("hello"u8.ToArray());
    writer.WriteEntry(new ArchiveEntry { Name = "note.txt", Size = input.Length }, input);
}
 
zip.Position = 0;
using var archive = ZipArchive.OpenArchive(zip);
var entry = archive.Entries.Single();
using var text = new StreamReader(entry.OpenEntryStream());
Console.WriteLine($"{entry.Key}: {entry.CompressionType}");
Console.WriteLine(text.ReadToEnd());
OutputText
note.txt: Deflate64
hello

Which archive formats do you need to read or write?

Choose by container, direction, and entry method. Deflate64 in a ZIP is not ordinary Deflate, and a library that reads it does not necessarily write it. This comparison covers OneArchive 1.2.0 and SharpCompress 0.50.12 (MIT).

ZIP: read or write a specific method

OneArchive: Read and write Store, Deflate, Deflate64, BZip2, Zstandard, and PPMd (variant I). Read LZMA and XZ. ZIP methods

SharpCompress: Read and write ZIP, including Zstandard in both directions. Deflate64, Shrink, Reduce, Implode, and XZ are read-only. ZIP matrix and note 2

7z: read or create, with solid output if needed

OneArchive: Read and write. The writer supports solid blocks and Copy, LZMA, LZMA2, Deflate, Deflate64, and Zstandard. Its Zstandard method requires a compatible decoder; standard 7-Zip builds cannot read it. Reader methods · Writer methods

SharpCompress: Read through the Archive API; write non-solid LZMA/LZMA2 7z to seekable output. Do not read the matrix’s decoder list as a list of writer methods. 7z matrix and note 4

ISO 9660: inspect or build an image

OneArchive: Read and write ISO 9660, with Joliet and Rock Ridge support. ISO reader and writer

SharpCompress: ISO is not listed. Format matrix

CAB: unpack an installer cabinet

OneArchive: Read only: stored, MSZIP, and LZX. No Quantum decoding or extraction of entries that span cabinets. CAB reader limits

SharpCompress: CAB is not listed. Format matrix

RAR: list entries or extract compressed data

OneArchive: Read only, RAR 5: list entries with readable headers and extract unencrypted stored entries. Compressed entries can be listed but not opened. RAR 4 and encrypted headers are unsupported. RAR reader limits

SharpCompress: Read and decompress RAR, including RAR 5; no writer. Solid RARs use the Reader API. RAR matrix and note 1 · RAR notes

Test the archives you actually exchange

For output, check what the recipient opens, not just what your writer emits. If both ends accept a Deflate64 ZIP but your app also needs to create one, the sample shows a split you can use: OneArchive for writing, SharpCompress for reading. If a consumer needs non-solid LZMA2 7z, both libraries can write it; if you need solid output, use OneArchive and test that archive in the recipient’s tool. OneArchive also accepts non-seekable 7z output, but buffers the whole archive before copying it out.

For incoming archives, keep sample files for each method and layout you accept. Use a compressed RAR 5 fixture if you need extraction: a successful listing only proves the headers were readable. If those files are routine, keep a RAR decoder even if you use OneArchive for ISO or CAB. The OneArchive getting-started guide covers the common archive API.