Net4x.DotNetZip
2.0.0.26244
dotnet add package Net4x.DotNetZip --version 2.0.0.26244
NuGet\Install-Package Net4x.DotNetZip -Version 2.0.0.26244
<PackageReference Include="Net4x.DotNetZip" Version="2.0.0.26244" />
<PackageVersion Include="Net4x.DotNetZip" Version="2.0.0.26244" />
<PackageReference Include="Net4x.DotNetZip" />
paket add Net4x.DotNetZip --version 2.0.0.26244
#r "nuget: Net4x.DotNetZip, 2.0.0.26244"
#:package Net4x.DotNetZip@2.0.0.26244
#addin nuget:?package=Net4x.DotNetZip&version=2.0.0.26244
#tool nuget:?package=Net4x.DotNetZip&version=2.0.0.26244
DotNetZip
Zip, zlib, gzip and bzip2 for .NET — Dino Chiesa's DotNetZip library, maintained and repackaged.
Create and read zip archives with a small, direct API: no streams to wire together for the common cases, no temp files to manage. Zip64, AES encryption, split archives, Unicode entry names and self-extracting executables are all supported.
Targets: net35, net40, netstandard2.0
dotnet add package Net4x.DotNetZip
Creating an archive
using Ionic.Zip;
using (var zip = new ZipFile())
{
zip.AddFile("report.pdf", "docs"); // into the "docs" folder in the archive
zip.AddDirectory(@"C:\photos", "pics");
zip.AddEntry("readme.txt", "generated at " + DateTime.Now);
zip.Save("archive.zip");
}
Reading and extracting
using (var zip = ZipFile.Read("archive.zip"))
{
foreach (ZipEntry e in zip)
Console.WriteLine("{0} {1} -> {2}", e.FileName, e.UncompressedSize, e.CompressedSize);
zip.ExtractAll(@"C:\out", ExtractExistingFileAction.OverwriteSilently);
}
Passwords and AES
using (var zip = new ZipFile())
{
zip.Password = "hunter2";
zip.Encryption = EncryptionAlgorithm.WinZipAes256; // or PkzipWeak
zip.AddFile("secret.docx");
zip.Save("secure.zip");
}
Password applies to entries added after it is set, so you can mix protected and
unprotected entries in one archive.
Writing entry content directly
An entry's bytes can come from a delegate rather than a file, which keeps large or generated content out of memory:
using (var zip = new ZipFile())
{
zip.AddEntry("data.csv", (name, stream) => WriteCsvTo(stream));
zip.Save("archive.zip");
}
Larger archives
using (var zip = new ZipFile())
{
zip.UseZip64WhenSaving = Zip64Option.AsNecessary; // > 4 GB, or > 65535 entries
zip.ParallelDeflateThreshold = 1024 * 1024; // compress big entries on many cores
zip.CompressionLevel = Ionic.Zlib.CompressionLevel.BestCompression;
zip.AddDirectory(@"C:\big");
zip.Save("big.zip");
}
Split (spanned) archives come from MaxOutputSegmentSize; progress is reported through the
SaveProgress, ReadProgress and ExtractProgress events.
The compression codecs on their own
The streams underneath the zip implementation are public API, usable without touching an archive:
using Ionic.Zlib;
using (var raw = File.OpenRead("data.bin"))
using (var gz = File.Create("data.bin.gz"))
using (var comp = new GZipStream(gz, CompressionMode.Compress))
raw.CopyTo(comp);
Ionic.Zlib provides GZipStream, DeflateStream, ZlibStream, ZlibCodec and
ParallelDeflateOutputStream. Ionic.BZip2 provides BZip2InputStream,
BZip2OutputStream and ParallelBZip2OutputStream. Ionic.Crc provides CRC32 and
CrcCalculatorStream.
Self-extracting archives
using (var zip = new ZipFile())
{
zip.AddDirectory(@"C:\payload");
zip.SaveSelfExtractor("setup.exe", SelfExtractorFlavor.ConsoleApplication);
}
SaveSelfExtractor emits a runnable .exe. It needs the stub resources embedded in the
.NET Framework builds, so it is available on the net35 and net40 targets rather than on
netstandard2.0.
License
Microsoft Public License (Ms-PL) for DotNetZip's own code, plus the terms of the projects
it derives from — zlib, jzlib, Apache Commons Compress and the LZMA SDK. See the LICENSE
and NOTICE files in the repository.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETStandard 2.0
- System.CodeDom (>= 9.0.0)
- System.Security.Permissions (>= 9.0.0)
- System.Text.Encoding.CodePages (>= 9.0.0)
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Net4x.DotNetZip:
| Package | Downloads |
|---|---|
|
Net4x.iText.Commons
Package Description |
|
|
Net4x.StandardTypesWrappers
Package Description |
|
|
Net4x.IonicWrapper
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2.0.0.26244 | 43 | 9/1/2026 |
| 2.0.0 | 20,546 | 3/31/2025 |