squid-box / SevenZipSharp

Fork of SevenZipSharp on CodePlex
GNU Lesser General Public License v3.0
265 stars 99 forks source link

Is it possible to extract only part of a file? #93

Open axzxc1236 opened 4 years ago

axzxc1236 commented 4 years ago

I have a use case that needs to process part of a file at a time

e.g. I have a compressed file that is 1GB after extracted, I have a code that access 0byte ~ 10Mbyte at first iteration, 10Mbyte ~ 20Mbyte at second iteration, is it possible to extract only a chunk of a file?
I currently using something like

MemoryStream mstream = new MemoryStream();
mstream = extractor.ExtractFile(filename, mstream);

which puts the whole file in RAM.

squid-box commented 4 years ago

While I'm by no means an expert on 7z, I don't believe there's a way to extract only a given set of bytes from an archive...

As SevenZipSharp looks right now there's no way to achieve this, and given answers like these I don't think it's possible, for 7z at least.