---
title: "onearchive"
url: https://recursiveai.org/onearchive/
description: "Compression codecs and archive formats for .NET in managed C#, with no native dependencies. Zstandard, LZ4, Deflate, xz, bzip2 and Brotli; tar, zip, 7z, ISO and compound files, extracted safely by default. A preview. MIT or Apache-2.0."
---

# 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.

```sh
dotnet add package RecursiveAI.OneArchive --prerelease
```

- [Getting started](https://recursiveai.org/onearchive/docs/getting-started/)
- [Docs](https://recursiveai.org/onearchive/docs/)
- [Cookbook](https://recursiveai.org/onearchive/cookbook/)
- [GitHub](https://github.com/recursive-ai-oss/onearchive-csharp)
- [NuGet](https://www.nuget.org/packages/RecursiveAI.OneArchive)

## 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 started](https://recursiveai.org/onearchive/docs/getting-started/)

*Program.cs · C#*

```
using 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"
```

### 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.

- [Where they stand](https://recursiveai.org/onearchive/docs/overview/#where-they-stand)
- [Benchmark method](https://recursiveai.org/onearchive/docs/bench-method/)

## 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 `Archive` API and every container, built on OneCompress. Preview, 0.7.0-preview.1.
- **Opting in**: Each codec family has its own diagnostic, `ONECOMPRESS001` to `ONECOMPRESS010`, and the archive layer has `ONEARCHIVE001`. Add the ones you use to `NoWarn`.
- **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.

## Go further

- [GitHub](https://github.com/recursive-ai-oss/onearchive-csharp)
- [NuGet: OneArchive](https://www.nuget.org/packages/RecursiveAI.OneArchive)
- [NuGet: OneCompress](https://www.nuget.org/packages/RecursiveAI.OneCompress)
- [Getting started](https://recursiveai.org/onearchive/docs/getting-started/)
- [All docs](https://recursiveai.org/onearchive/docs/)
- [Cookbook](https://recursiveai.org/onearchive/cookbook/)
- [Untrusted archives](https://recursiveai.org/onearchive/cookbook/safe-extraction/)
- [Zstandard dictionaries](https://recursiveai.org/onearchive/cookbook/zstd-dictionaries/)
- [Changelog](https://github.com/recursive-ai-oss/onearchive-csharp/blob/v0.7.0-preview.1/CHANGELOG.md)
