Soenneker.Compression.Zip
11.0.82
Prefix Reserved
dotnet add package Soenneker.Compression.Zip --version 11.0.82
NuGet\Install-Package Soenneker.Compression.Zip -Version 11.0.82
<PackageReference Include="Soenneker.Compression.Zip" Version="11.0.82" />
<PackageVersion Include="Soenneker.Compression.Zip" Version="11.0.82" />
<PackageReference Include="Soenneker.Compression.Zip" />
paket add Soenneker.Compression.Zip --version 11.0.82
#r "nuget: Soenneker.Compression.Zip, 11.0.82"
#:package Soenneker.Compression.Zip@11.0.82
#addin nuget:?package=Soenneker.Compression.Zip&version=11.0.82
#tool nuget:?package=Soenneker.Compression.Zip&version=11.0.82
Soenneker.Compression.Zip
High-performance, asynchronous ZIP compression and secure extraction for .NET.
Features
- Streams file contents asynchronously with configurable buffers
- Atomically replaces completed archive files, preserving the previous archive on failure
- Writes extracted files to temporary files before moving them into place
- Rejects ZIP-slip traversal, links, duplicate destinations, and file/directory collisions
- Supports optional entry-count, expanded-size, and compression-ratio limits for untrusted archives
- Preserves file and directory timestamps
- Supports paths and caller-owned streams
- Uses only the ZIP implementation built into .NET
Installation
dotnet add package Soenneker.Compression.Zip
Quick start
using Soenneker.Compression.Zip;
var zip = new ZipUtil();
await zip.Compress("./input", "./output/archive.zip", cancellationToken: cancellationToken);
await zip.Extract("./output/archive.zip", "./restored", cancellationToken: cancellationToken);
Extraction does not overwrite existing files by default. Opt in when replacement is intended:
using Soenneker.Compression.Zip.Options;
await zip.Extract(
"./archive.zip",
"./destination",
new ZipExtractionOptions { OverwriteFiles = true },
cancellationToken);
Dependency injection
using Soenneker.Compression.Zip.Registrars;
services.AddZipUtilAsSingleton();
Then inject IZipUtil:
using Soenneker.Compression.Zip.Abstract;
public sealed class ArchiveService(IZipUtil zip)
{
public ValueTask Backup(string source, string archive, CancellationToken cancellationToken = default) =>
zip.Compress(source, archive, cancellationToken: cancellationToken);
}
Compression options
using System.IO.Compression;
using Soenneker.Compression.Zip.Options;
var options = new ZipCompressionOptions
{
CompressionLevel = CompressionLevel.Fastest,
IncludeBaseDirectory = true,
Overwrite = true,
PreserveTimestamps = true,
BufferSize = 128 * 1024
};
await zip.Compress("./input", "./archive.zip", options, cancellationToken);
File-system reparse points are intentionally skipped during compression.
Extracting untrusted archives
Path and link validation is always enabled. For externally supplied archives, set limits appropriate for your workload to reduce ZIP-bomb risk:
var options = new ZipExtractionOptions
{
MaximumEntryCount = 10_000,
MaximumEntrySize = 256L * 1024 * 1024,
MaximumTotalUncompressedSize = 2L * 1024 * 1024 * 1024,
MaximumCompressionRatio = 200
};
await zip.Extract(uploadStream, "./destination", options, cancellationToken);
Caller-owned streams remain open. Archive streams used for extraction must be readable and seekable.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net11.0 is compatible. |
-
net11.0
- Soenneker.Utils.Directory (>= 11.0.986)
- Soenneker.Utils.File (>= 11.0.2348)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Soenneker.Compression.Zip:
| Package | Downloads |
|---|---|
|
Soenneker.Firmware.SeaPilot
Seagate firmware discovery and downloads using OpenSeaChest and stealth browser automation. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 11.0.82 | 149 | 11/19/2026 |
| 11.0.81 | 120 | 11/19/2026 |
| 11.0.80 | 88 | 11/18/2026 |
| 11.0.79 | 122 | 11/18/2026 |
| 11.0.78 | 110 | 11/18/2026 |
| 11.0.76 | 124 | 11/18/2026 |
| 11.0.75 | 150 | 11/15/2026 |
| 11.0.74 | 171 | 11/11/2026 |
| 11.0.72 | 117 | 11/11/2026 |
| 11.0.70 | 152 | 11/11/2026 |
| 11.0.69 | 98 | 11/11/2026 |
| 11.0.68 | 150 | 11/11/2026 |
| 11.0.67 | 97 | 11/11/2026 |
| 11.0.66 | 275 | 11/3/2026 |
| 11.0.65 | 142 | 11/3/2026 |
| 11.0.63 | 135 | 11/3/2026 |
| 11.0.62 | 118 | 11/3/2026 |
| 11.0.61 | 231 | 10/29/2026 |
| 11.0.60 | 122 | 10/27/2026 |
| 4.0.54 | 372 | 10/15/2026 |
Updated Soenneker.Utils.File to 11.0.2348