Working with 7z Archives

Overview

7-Zip is a file archiver with a high compression ratio. Aspose.ZIP API lets work with creating and managing 7-Zip archives in your applications without the need of any other 3rd party applications. Aspose.ZIP API provides SevenZipArchive class to work with 7-Zip archives. This class provides various methods to perform operations on archives. API provides the SevenZipArchiveEntry class to represents a single file within the 7z archive.

Create a 7-Zip Single Entry

The following code example demonstrates how to create a 7-Zip entry using SevenZipArchive instance.

Create 7-Zip Archive Entries

The SevenZipArchive class provides CreateEntries methods to add files and directories recursively in the given directory given. The following code example demonstrates how to create 7-Zip archive entries.

7-Zip Encryption Settings

Aspose.ZIP API provides SevenZipAESEncryptionSettings class which provides Settings for AES encryption or decryption for 7z archives. The following code example demonstrates how to provide AES Encryption Settings.

7-Zip Archive with LZMA Compression

The following code example demonstrates how to create a 7z archive with LZMA compression.

Setting Different Password for Entries

The following code example demonstrates how to create an archive with entries encrypted with different passwords for each entry.

Extraction of 7z archives

The following code example demonstrates how to extract 7z archive to directory.