Class ZipSaveOptions
Provides options for configuring an IronZip archive.
Inheritance
Namespace: IronZip
Assembly: IronZip.dll
Syntax
public class ZipSaveOptions : Object
The compression level, password, and encryption method for a save are carried by ZipSaveOptions. It groups the three settings that control how an archive is written so they travel together instead of as loose arguments. Construct one with new ZipSaveOptions() and set the properties that matter.
Compression sets the level for the size-versus-speed trade-off, Password sets the password applied to the archive, and EncryptionMethod selects the scheme through an EncryptionMethods value (AES256, AES128, or Traditional). Pass the configured object to IronZipArchive.SaveAs(path, options) or Save(options), or assign it to the archive's ZipSaveOptions property so later saves reuse it. Leaving Password unset writes an unencrypted archive. Reusing one options object across saves keeps a consistent password and compression for a batch of archives, and the object read back from the ZipSaveOptions property shows what a loaded archive will apply on its next save.
using IronZip;
using var archive = new IronZipArchive();
archive.Add("report.pdf");
archive.SaveAs("secure.zip", new ZipSaveOptions { Password = "p@ss", EncryptionMethod = EncryptionMethods.AES256 });The password-protect ZIP example uses these options, and the create ZIP example shows a plain save for comparison.
Constructors
ZipSaveOptions()
Declaration
public ZipSaveOptions()
Properties
Compression
Gets or sets the compression level (default is 9).
Declaration
public int Compression { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
EncryptionMethod
Gets or sets the encryption method.
Declaration
public EncryptionMethods EncryptionMethod { get; set; }
Property Value
| Type | Description |
|---|---|
| EncryptionMethods |
Password
Gets or sets the password for encryption (null if not set).
Declaration
public string Password { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |