I'm using SevenZipSharp
and it has Size property in ArchiveFileInfo
struct, that "Gets or sets size of the file (unpacked)".
How can I get size of packed file in archive?
Use the GetCompressedFileSize function to obtain the compressed size of a file. If the file is compressed, its compressed size will be less than its uncompressed size. Use the GetFileSize function to determine the uncompressed size of a file.
7-Zip is a free and open-source file archiver for compressing and uncompressing files. If you need to save some disk space or make your files more portable, this software can compress your files into an archive with a . 7z extension.
WinRAR and WinZip compression speeds, 7-Zip is typically a little slower. The program will give you a file size around 40% of the original file. Like WinZip, 7-Zip offers AES-256 password-protected encryption in the ZIP format, but it also offers this encryption in 7z.
Unfortunately it seems that SevenZipSharp doesn't fill this info. Here's for example how it fills unpacked size in ArchiveFileInfo
:
var fileInfo = new ArchiveFileInfo { Index = (int)i };
...
_archive.GetProperty(i, ItemPropId.Size, ref data);
fileInfo.Size = NativeMethods.SafeCast<ulong>(data, 0);
ItemPropId
enum has PackedSize
property which is not used though, I suppose due to the fact it may be absent (according to the comment):
/// <summary>
/// Item packed sise; usually absent
/// </summary>
PackedSize,
So I guess the only way to get it is to fork SevenZipSharp and try to fix it yourself (or search for an already existing fork). If it's possible at all.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With