ZipCompressionOptions Class
Options to write a zip archive (ZipArchive in ZipArchiveMode.Create and ZipArchiveMode.Update modes): the defaults of the new entries, which ZipEntryOptions overrides, and the zip64 policy.
public sealed class ZipCompressionOptionsConstructors
| Name | Description |
|---|---|
| ZipCompressionOptions() |
ZipCompressionOptions()
ZipCompressionOptions.cspublic ZipCompressionOptions()No documentation is available.
Properties
| Name | Description |
|---|---|
| CompressionLevel | Gets or sets the compression level of the entries. The default is CompressionLevel.Optimal. For LZMA and XZ, the levels are the presets 0 (CompressionLevel.NoCompression), 1 (CompressionLevel.Fastest), 6 (CompressionLevel.Optimal) and 9 (CompressionLevel.SmallestSize); for PPMd, the levels 1, 1, 5 and 9 of 7-Zip; for BZip2, blocks of 100 kB for the fastest levels and of 900 kB otherwise. The level does not change the method: use ZipCompressionMethod.Stored to store the content. |
| CompressionMethod | Gets or sets the compression method of the entries. The default is ZipCompressionMethod.Deflate. The methods that can be written are ZipCompressionMethod.Stored, ZipCompressionMethod.Deflate, ZipCompressionMethod.BZip2, ZipCompressionMethod.Lzma, ZipCompressionMethod.Ppmd, ZipCompressionMethod.Xz and ZipCompressionMethod.Zstandard (on .NET 11 only, whose System.IO.Compression has a Zstandard encoder); the other methods throw a NotSupportedException when an entry is created. An empty file is always stored. |
| Encryption | Gets or sets the encryption of the entries that have a password. The default is ZipEncryption.Aes256. ZipEncryption.None writes the entries without encryption, even with a password. ZipEncryption.ZipCrypto is weak: use it only for the tools that do not read WinZip AES. |
| Password | Gets or sets the password that encrypts the content of the entries (encoded as UTF-8), or null to not encrypt them. The names, the sizes and the times of the entries are not encrypted. |
| Zip64 | Gets or sets when the zip64 extensions are written. The default is Zip64Mode.Auto. |
CompressionLevel
ZipCompressionOptions.csGets or sets the compression level of the entries. The default is CompressionLevel.Optimal. For LZMA and XZ, the levels are the presets 0 (CompressionLevel.NoCompression), 1 (CompressionLevel.Fastest), 6 (CompressionLevel.Optimal) and 9 (CompressionLevel.SmallestSize); for PPMd, the levels 1, 1, 5 and 9 of 7-Zip; for BZip2, blocks of 100 kB for the fastest levels and of 900 kB otherwise. The level does not change the method: use ZipCompressionMethod.Stored to store the content.
public CompressionLevel CompressionLevel { get; set; }Property value
CompressionMethod
ZipCompressionOptions.csGets or sets the compression method of the entries. The default is ZipCompressionMethod.Deflate. The methods that can be written are ZipCompressionMethod.Stored, ZipCompressionMethod.Deflate, ZipCompressionMethod.BZip2, ZipCompressionMethod.Lzma, ZipCompressionMethod.Ppmd, ZipCompressionMethod.Xz and ZipCompressionMethod.Zstandard (on .NET 11 only, whose System.IO.Compression has a Zstandard encoder); the other methods throw a NotSupportedException when an entry is created. An empty file is always stored.
public ZipCompressionMethod CompressionMethod { get; set; }Property value
Encryption
ZipCompressionOptions.csGets or sets the encryption of the entries that have a password. The default is ZipEncryption.Aes256. ZipEncryption.None writes the entries without encryption, even with a password. ZipEncryption.ZipCrypto is weak: use it only for the tools that do not read WinZip AES.
public ZipEncryption Encryption { get; set; }Property value
Password
ZipCompressionOptions.csGets or sets when the zip64 extensions are written. The default is Zip64Mode.Auto.
public Zip64Mode Zip64 { get; set; }