How to Convert CAB to TAR.BZ2 Using C#

In order to convert CAB to TAR.BZ2, we’ll use

Aspose.ZIP for .NET

API which is a feature-rich, powerful and easy to use archive conversion API for C# platform. Open


package manager, search for Aspose.ZIP and install. You may also use the following command from the Package Manager Console.

Package Manager Console Command

PM> Install-Package Aspose.Zip

Steps to Convert CAB to TAR.BZ2 via C#

Convertation from one archive format to another consist of following steps:

  1. Extract archive to intermediate storage
  2. Compress extracted data to desired format

System Requirements

Before running the conversion example code, make sure that you have the following prerequisites.

  • Microsoft Windows or a compatible OS with .NET Framework, Mono and COM Interop.
  • Development environment like Microsoft Visual Studio.
  • Aspose.ZIP for .NET DLL referenced in your project.

Sample code to convert from CAB to TAR.BZ2

Code from CAB to various formats. The CAB archive contains several records, and the GZ, LZ, Z, XZ, BZ2 formats compress one source. Therefore, compression into these formats is done by packaging first into a TAR archive, which is typical for Linux.

Convert from CAB to TAR.BZ2 - C#

using (TarArchive tarArchive = new TarArchive())
    using (Bzip2Archive bzip2Archive = new Bzip2Archive())
        using (CabArchive cabArchive = new CabArchive(""))
            for (int i = 0; i < cabArchive.Entries.Count; i++)
                var ms = new MemoryStream();
                ms.Seek(0, SeekOrigin.Begin);
                tarArchive.CreateEntry(cabArchive.Entries[i].Name.Replace('\\', '/'), ms);

  • Free App to Convert CAB to TAR.BZ2

    Check our live demos for CAB to TAR.BZ2 conversion with following benefits.

      No need to download or setup anything.
      No need to write any code.
      Just upload your CAB archive and hit the "Convert" button.
      You will instantly get the download link for TAR.BZ2 file.
    A reliable Aspose.ZIP Library that can compress, extract, encrypt, decrypt, convert and merge archives. Aspose.ZIP for .NET API allows to manipulate various archive types without without going into the underlying complexity of the compress file formats with minimum coding efforts.

    Other Supported Conversions

    You can also convert CAB into many other file formats including few listed below.

    CAB TO ZIP (Zipped (compressed) Files)
    CAB TO 7ZIP (7zip Archive)
    CAB TO TAR.BZ2 (Burrows–Wheeler Compressor)
    CAB TO CPIO (Copy In, Copy Out Archive)
    CAB TO TAR.GZ (Streaming Deflate Compressor)
    CAB TO TAR.LZ (LZMA Multi-Block Compressed Data)
    CAB TO TAR (Tape Archive)
    CAB TO TAR.XZ (Container for Compressed Streams)
    CAB TO TAR.Z (LZW Compressor)