When using DotNetZip, is it possible to get what the final zip file size will be before calling Save(stream)? I have a application(Window Service) where package Stream size is more than 100MB then package will saved and upcoming files add into new package.
I got same question for web application but not understand the answer. Is there any way into DotnetZip to find the size of zip stream before save on I/O system?
The answer is quite clear, but requires some fundamental understanding of compression. Take, for example, a look at LZW.
It comes down to this: a compression engine does not know the final size of the compressed data before compressing all the source data. And you'd rather not want to do that twice.
As explained in the documentation of dotnetzip, the compression only starts when calling
ZipFile.Save()
.I got the solution. Here is code.Now I will create the package which size is less then 100MB.