onearchive
Compression codecs and archive formats for .NET, in managed code with no native libraries. The compressed bytes are identical on every platform.
A preview, 0.7.0-preview.1. Each codec and the archive layer stay marked experimental until they meet their speed targets.
A quick look
One call per codec, and one per archive. The format comes from the extension when you write and from the bytes when you read.
Getting startedusing RecursiveAI.OneArchive; using RecursiveAI.OneCompress.Zstd; byte[] packed = Zstd.Compress(data, new ZstdCompressionOptions { Level = 19 }); Archive.Create("backup.tar.zst").Add("assets/").Save(); Archive.Extract("upload.zip", "out"); // nothing lands outside "out"
What it does
Zstandard, fully
Frames, dictionaries and dictionary training, long-distance matching, multithreaded jobs and the seekable format.
Every common codec
LZ4, Deflate, zlib, gzip, Deflate64, LZMA, LZMA2, xz, lzip, bzip2, Brotli and PPMd, the LZX decoder, and CRC32, CRC32C, CRC64, Adler-32 and xxHash64.
Archives, read and written
tar, zip, 7z, cpio, ar, ISO 9660 with Joliet and Rock Ridge, and Microsoft compound files. cab and RAR 5 are read.
Safe extraction by default
No writes outside the target, no escaping links, and limits on size, expansion ratio, entry count and path length, each loosened only when you ask.
Encryption
WinZip AES for zip, read and written, and AES-256 for 7z, with encrypted headers.
Small binaries
An app that uses a few codecs can switch the rest off and trim them away, for a smaller NativeAOT or WebAssembly build.
Measured against the reference tools
Each codec is measured against its reference tool (zstd, lz4, libdeflate, zlib-ng, bzip2, xz, lzip and 7-Zip) on Silesia, enwik8 and small game payloads. The target is a size within 1% and at least 0.87 of the tool’s speed at every level, and the overview has every row. Output is byte-identical across x64 and arm64, JIT and NativeAOT, and WebAssembly.
The packages
- RecursiveAI.OneCompress
The codecs and checksums, each in one-call, streaming and low-level forms. Preview, 0.7.0-preview.1.
- RecursiveAI.OneArchive
The
ArchiveAPI and every container, built on OneCompress. Preview, 0.7.0-preview.1. - Opting in
Each codec family has its own diagnostic,
ONECOMPRESS001toONECOMPRESS010, and the archive layer hasONEARCHIVE001. Add the ones you use toNoWarn. - Not yet
BCJ2 in 7z, and compressed RAR entries, raise a typed “unsupported” error.
- .NET
.NET 10, managed code only. NativeAOT, trimming and browser WebAssembly are supported; AES is not available in the browser. MIT or Apache-2.0.