We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Access, Reuse Existing Compression/Encryption Settings

Is there a way to access the existing CompressionSettings/ExceptionSettings properties of an ArchiveEntry object? Our process takes an existing file from an ArchiveEntry, makes some modifications, and then attempts to replace it in the zip archive, and we need the replacement entry to use exactly the same compression and encryption settings. We will have the password used to create the entry in the first place, we just won’t know what type of encryption was used, nor what level of compression and the other things stored in those values.

Thanks for any info on this,
Michael Whalen

Another thought is if there’s an “Update” or “Replace” method, like the “UpdateEntry” method that’s available in DotNetZip, documented here: https://documentation.help/DotNetZip/8e97c2ad-5d61-7aec-f71e-3d5c186973ab.htm

Michael Whalen


We have logged your requirements with ID “ZIPNET-282” and ID “ZIPNET-283” for further investigation. You will automatically be informed here once we have more information to share.

Hello Michael,
Tomorrow we will provide you with a modified 18.11.1 version having compression and encryption settings exposed for an entry. Those changes will also be included in upcoming 18.12 version alongside with new features.

Great - thanks for the quick turnaround.


Hello Michael, please find the modified version attached.
Below is the sample code that reuses settings of excluded entry at index 0 to appended one.

using (Archive archive = new Archive("arch.zip"))
    CompressionSettings compressionSettings = archive.Entries[0].CompressionSettings;
    EncryptionSettings encryptionSettings = null;
    if (archive.Entries[0] is ArchiveEntryEncrypted)
        encryptionSettings = ((ArchiveEntryEncrypted)archive.Entries[0]).EncryptionSettings;
        encryptionSettings.Password = "p@s$";
    archive.CreateEntry("newfile.txt", File.OpenRead("newfile.txt"), new ArchiveEntrySettings(compressionSettings, encryptionSettings));

Please update to 18.12 version when it become ready.
Aspose.ZIP_18.11.1.zip (2.0 MB)

It works perfectly - thanks again!

– Michael Whalen