Overwiew

Aspose.ZIP for .NET is a flexible documents compression and archive manipulation API for standard ZIP format. API enables .NET applications to achieve files compression/decompression, archiving files as well as folders and encryption of archives. This API works with all well known archive formats: ZIP, RAR, 7Zip, GZIP, BZ2. And with many archive formats from Linux: CPIO, TAR, Lzip, Bzip2, XZ, Z. It provides protection via user-defined passwords and traditional encryption using ZipCrypto or AES encryption such as AES128, 192 and AES256.

Integrating Compression API in a .NET Application

Unlock the power of compression within your .NET application seamlessly. This section unveils the art of integrating a Compression API to enhance the efficiency and performance of your .NET projects. From reducing file sizes to optimizing data storage, learn how to seamlessly implement compression, empowering your application with streamlined functionality. Dive into the intricacies of the Compression API and elevate your .NET development experience.

Simple example using the System.IO.Compression namespace in C# for compressing and decompressing a file. Note that this is a basic example, and in a real-world scenario, you might want to handle exceptions and include additional error checking.

    using System.IO;
    using Aspose.Zip.Gzip;

    class Program
    {
        static void Main()
        {
            string sourceFilePath = "example.txt";
            string compressedFilePath = "example.gz";

            using (FileStream sourceFileStream = new FileStream(sourceFilePath, FileMode.Open))
            {
                using (FileStream compressedFileStream = File.Create(compressedFilePath))
                {
                    using (GzipArchive archive = new GzipArchive())
                    {
                        archive.SetSource(sourceFileStream);
                        archive.Save(compressedFileStream);
                    }
                }
            }
        }
    }

Creating an Archive from One or More Files Using C#

Delve into the realm of archiving with C# as your tool of choice. This guide will walk you through the process of creating a comprehensive archive, whether youre bundling a single file or multiple files into one. Gain valuable insights into leveraging C# for efficient archive creation, fostering better file organization and management.

How to Add files to archives without compression via C#

Adding files to archives without compression is a strategic decision in information processing, offering several advantages. Furthermore, a list of advantages that such an approach can provide is provided. Firstly, convenience in transportation and transmission, as the combined file becomes compact. Additionally, it saves time and effort since there is no need to search for individual files. Accessibility to individual files remains quick and easy, and the format and compatibility with various programs remain unchanged. Examples of situations for using this approach include document exchange, creating backups of important data, archiving photos, and preparing presentations.

How To Add Files to ZIP Archives Without Compression

    using (FileStream zipFile = File.Open("archive.zip", FileMode.Create))
    {
        FileInfo fi1 = new FileInfo("alice29.txt");
        FileInfo fi2 = new FileInfo("asyoulik.txt");
        using (Archive archive = new Archive(new ArchiveEntrySettings(new StoreCompressionSettings())))
        {
            archive.CreateEntry("alice29.txt", fi1);
            archive.CreateEntry("lcet10.txt", fi2);
            archive.Save(zipFile);
        }
    }

Encrypting and Decrypting: Safeguarding Your Archive's Integrity

Security is paramount, especially when dealing with sensitive data within archives. This section focuses on the crucial aspects of encrypting and decrypting archives, providing a robust shield for your information. Whether you need to secure the entire archive or specific entries, learn the techniques and best practices to ensure the integrity and confidentiality of your data.

How To Add entries to existing archive

Adding records to an existing archive is an effective approach when selectively adding or updating files for efficient archive management and maintaining their relevance. This method facilitates the conservation of disk space, mitigates information duplication, and guarantees the inclusion of solely essential data within the archive. Disk space efficiency is especially advantageous in scenarios of constrained free space or when utilizing cloud storage. The preservation of solely the current versions of files stands as a pivotal strategy, enabling the convenience of management and enhancing search efficiency. This approach ensures that the archive exclusively houses relevant data.

How To Delete entries from existing archive

Deleting records from an existing archive is an effective approach when selectively removing or updating files for efficient archive management and maintaining their relevance. This method enables saving disk space, avoiding information duplication, and ensuring that the archive contains only necessary data. Disk space efficiency becomes particularly beneficial with limited free space or when utilizing cloud storage. The convenience of management and search efficiency is made possible by preserving only the current versions of files, making the removal of records a crucial strategy. This ensures the archive contains only relevant data. In this example, all records are deleted except the last one.

How To Delete entries from existing archive

    using (var archive = new Archive("archive.zip"))
    {
        while (archive.Entries.Count > 1)
            archive.DeleteEntry(archive.Entries[0]);
        archive.Save("last_entry.zip");
    } 

How to Compress folder respecting its structure

Compressing a folder while maintaining its structure is a crucial skill for efficient file management. This guide will walk you through the steps to compress a folder, ensuring that its internal organization is preserved. Whether you’re archiving projects or optimizing storage, understanding how to compress folders effectively can streamline your workflow.

How to Decompress to directory respecting archive structure

Successfully decompressing files is just as important as compressing them. In this section, discover the art of decompressing archives to a directory while keeping the original structure intact. Uncover the techniques to efficiently extract files, ensuring that your decompressed content remains organized and easily accessible.

Harnessing Parallelism: Compressing Documents of Any Size

Uncover the power of parallelism in compressing documents of all sizes. This section explores advanced methods for compressing large files, making the most of parallel processing. Learn how to optimize the compression process for improved efficiency and faster results, ensuring that no document is too large to benefit from compression.
  

Support and Learning Resources

  
  

Aspose.Zip offers individual archive processing APIs for other popular development environments, listed below: