SevenZipSharp icon indicating copy to clipboard operation
SevenZipSharp copied to clipboard

Access archives within archives quickly

Open fiddyschmitt opened this issue 4 years ago • 0 comments

Hi Joel,

I have a series of nested archives:

clonezilla-live-2.7.2-38-amd64.iso
        live\filesystem.squashfs
                usr\sbin\partclone.btrfs

The iso is available here if you need.

I can drill down using the following code:

var filename = @"E:\iso\clonezilla-live-2.7.2-38-amd64.iso";

SevenZipBase.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");

//this is fast
var isoExtractor = new SevenZipExtractor(filename);
var isoFilenames = isoExtractor.ArchiveFileNames;

//this is fast
var squashFsStream = new MemoryStream();
isoExtractor.ExtractFile(@"live\filesystem.squashfs", squashFsStream);
var squashFsExtractor = new SevenZipExtractor(squashFsStream, InArchiveFormat.SquashFS);
var squashFsFilenames = squashFsExtractor.ArchiveFileNames;

//this is slow
var partcloneBtrfsStream = new MemoryStream();
squashFsExtractor.ExtractFile(@"usr\sbin\partclone.btrfs", partcloneBtrfsStream);    //specifically this step takes 20 seconds
var btrfsExtractor = new SevenZipExtractor(partcloneBtrfsStream, InArchiveFormat.Elf);
var btrfsFilenames = btrfsExtractor.ArchiveFileNames;

The 7-Zip GUI lets me drill into the nested archives without any delay using the "Open Inside" feature: 7ZFM

Do you have any suggestions for improving the speed?

Thanks, Fidel

fiddyschmitt avatar Jul 01 '21 04:07 fiddyschmitt