Process bzip2 or bz2 files using Bzip2Archive Class of Aspose.ZIP for .NET

The following code:

using (FileStream zipFile = File.Open("/tmp/jobReport.json.bz2", FileMode.Open))
{
    using (var archive = new Archive(zipFile))
    {
        var list = archive.Entries.ToList(); //.ExtractToDirectory(dataDir + "DecompressFolder_out");
    }
}

Throws exception:

System.IO.IOException : An attempt was made to move the file pointer before the beginning of the file : 'C:\tmp\jobReport.json.bz2'
   at System.IO.FileStream.SeekCore(SafeFileHandle fileHandle, Int64 offset, SeekOrigin origin, Boolean closeInvalidHandle)

This is the input file:

https://www.dropbox.com/s/vi2du8f0ru3vpp9/jobReport.json.bz2?dl=0

It is a simple file compressed on a MAC using bzip2

@russ.nichols

We have tested the scenario and have managed to reproduce the same issue at our side. For the sake of correction, we have logged this problem in our issue tracking system. You will be notified via this forum thread once this issue is resolved. We will share the issue ID with you soon.

We apologize for your inconvenience.

@russ.nichols

The issue ID for your issue is ZIPNET-375. We will inform you via this forum thread once there is an update available on this issue.

@russ.nichols
The archive you shared is not a zip archive, it is bzip2 one. It can’t be opened with Aspose.Zip.Archive, it has to be opened with Aspose.Zip.Bzip2.Bzip2Archive.

@russ.nichols

It is to inform you that the issue which you are facing is actually not a bug in Aspose.Words. So, we have closed this issue (ZIPNET-375) as ‘Not a Bug’.

Please use the following code example to read the bzip2 file format.

using (var archive = new Aspose.Zip.Bzip2.Bzip2Archive("jobReport.json.bz2"))
{
    using (var extractedFile = File.Create("jobReport.json"))
    {
        using (var content = archive.Open())
        {
            content.CopyTo(extractedFile);
        }
    }
}