Search code examples
phpzipphp-ziparchive

Estimate ZipArchive size before creation


Is there any way of estimating ZipArchives output size (before creating) given that I know the filesizes of the inputs? I couldn't find a definitive in the docs regarding ratios: e.g. 1mb compresses to 800kb or whatever.


Solution

  • It's pretty impossible to estimate it because it depends of the content of the files added. If a file added contains many of same characters, the compression will be high. If there are many differents bytes, the compression will be low.

    It also could depends of lossless data compression. Some media formats could be compressed more (in acceptable way) than another unknown binary format.