SWCompression icon indicating copy to clipboard operation
SWCompression copied to clipboard

Is there a way to extract a single file from a 7z compressed archive?

Open breakind opened this issue 1 year ago • 4 comments

I'm using SevenZipEntryInfo to get the list of files in a 7z archive. Is there a way to unzip a specific file individually, rather than unzipping all files using the open method?

breakind avatar Mar 04 '24 05:03 breakind

No, currently there is no such functionality.

tsolomko avatar Mar 04 '24 08:03 tsolomko

Are there plans for this in the future? It may be more appropriate in certain scenarios on mobile devices to operate on individual files separately, especially considering that some files are quite large and the time it takes to decompress all at once is extremely long.

breakind avatar Mar 04 '24 09:03 breakind

While I appreciate the problem, that you have highlighted, in the case of 7-Zip it is a bit tricky to resolve. The issue is that 7-Zip contains inside of it not just files, but "streams" of data (in 7-Zip terminology). Each of the streams can contain the data for multiple files at the same time, and this combined data is compressed together. So, if you want to decompress data for only one file, most likely you will still end up decompressing data for multiple files (the entire stream), or in the worst case, for all the files in the archive.

So it may very well be impossible to speed up the extraction of a single file in the general case.

tsolomko avatar Apr 21 '24 14:04 tsolomko

Thank you very much for your reply.

breakind avatar Apr 23 '24 04:04 breakind