In SharpZipLib we use ZipEntry like this:
var fi = new FileInfo(file);
var ze = new Sharp.Zip.ZipEntry(fi.Name);
ze.DateTime = fi.LastAccessTime;
ze.Size = fi.Length;
stream.PutNextEntry(ze);
var buffer = new byte[4096];
var byteCount = 0;
using (FileStream inputStream = File.OpenRead(fi.FullName))
{
byteCount = inputStream.Read(buffer, 0, buffer.Length);
while (byteCount > 0)
{
stream.Write(buffer, 0, byteCount);
byteCount = inputStream.Read(buffer, 0, buffer.Length);
}
inputStream.Close();
}
stream.CloseEntry();
There is a ze.CompressedSize property but it is -1 and populated only after the CloseEntry() which creates the zip file.
Is there a way to find out the Compressed size of the zip file without putting the files and actually creating it.