We are using DotNetZipLib for handling zip files.
I have a zip file which contains another zip file which contains a lot of (large) files.
outerZipFile.zip
-> foo.ext
-> innerZipFile
-> file 1
-> file 2
-> bar.ext
I want to open the inner zip file without having to read the whole entry into memory at once nor extract it to the hard drive. I have found no way to open the inner entry as a stream because this throws an exception:
public void Foo(Stream source)
{
using (var zip = ZipFile.Read(source))
{
foreach (var entry in zip.Entries)
{
if (entry.FileName != "innerZipFile")
{
continue;
}
var stream = entry.OpenReader();
// throws 'Ionic.Zip.ZipException'
// Cannot read that as a ZipFile
var innerZip = ZipFile.Read(stream);
}
}
}
Is there any way to open the inner zip from a stream without having to read the complete data?
My goal is to read just some of the inner entries without having to extract the whole inner zip (even into memory), because the inner zip can be up to 1GB of data.