Compose Multi-volume Cab Archive

Overview

Aspose.ZIP for .NET allows you to create CAB archives split into multiple files (volumes). This is achieved using the SaveSplit method, which divides a large archive into several linked cabinet volumes for easier storage and transfer. Extraction of multi-volume CAB archives is not yet supported.

Options for split archive

To configure how a CAB archive is split, use the SplitCabSaveOptions constructor, which requires two parameters:

The volume size must be from 65,536 to 2,147,483,647 bytes inclusive. The file name may include the .cab extension or omit it. It must not contain a path, non-ASCII characters, or characters that are not valid in a cabinet name.

For a base name of part, the output files are named part1.cab, part2.cab, part3.cab, and so on. All volumes except the last one normally have exactly the specified size. The last volume is smaller when the archive data does not divide evenly. The destination directory must already exist, and existing volume files are not overwritten.

Compose multi-volume archive

The following example demonstrates how to create a split CAB archive with each volume sized at 65,536 bytes (except, possibly, the last volume). The volume files will be named part1.cab, part2.cab, part3.cab, and so on:

1    FileInfo fi1 = new FileInfo("alice29.txt");
2    FileInfo fi2 = new FileInfo("picture.png");
3
4    using (CabArchive archive = new CabArchive())
5    {
6        archive.CreateEntry("alice29.txt", fi1);
7        archive.CreateEntry("picture.png", fi2);
8        archive.SaveSplit(@"C:\Folder", new SplitCabSaveOptions("part", 65536));
9    }

Multi-volume CAB archives support the same compression methods as regular CAB archives, including MSZip and Store. Aspose.ZIP for .NET can compose these archives, but it cannot extract them.