Reputation: 9265
Is there any way of estimating ZipArchive
s 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.
Upvotes: 1
Views: 257
Reputation: 121
As Syscall mentioned it is really hard to estimate.
If you need this feature, you could use old data to estimate new zip.
For example:
You want to create a backup of your assets folder. You can track your creation time and save this result.
After that, you know your first run took (let's say) 1.5minutes. Then you could estimate next run in relation to your growth of data you want to compress. Maybe +10% or +20%
Hope this helps
Upvotes: 1
Reputation: 19764
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.
Upvotes: 3