且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

zlib:解压缩的文件大小?

更新时间:2023-11-10 10:37:46

如果文件是使用gzip压缩的格式(RFC1952),然后是最后4个字节,ISIZE字段指示未压缩的文件大小为mod 2 ^ 32。因此,如果原始文件小于4GB,则可以通过读取最后4个字节来确定其大小。

If your file was compressed using the gzip format (RFC1952), then the last 4 bytes, the ISIZE field indicates the uncompressed file size mod 2^32. Therefore, provided that the original file was smaller than 4GB, you can determine its size by reading the last 4 bytes. Check the man pages for gunzip.

如果使用ZLIB或原始Deflate格式,则必须先解压缩以确定未压缩的大小。

If ZLIB or raw Deflate format was used, you will have to decompress first to determine the uncompressed size.