How to determine content-length header for a zip stream using common.compress lib

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

How to determine content-length header for a zip stream using common.compress lib

yogeshrai
This post was updated on .
Is it possible to set accurate content-length header while writing down zip stream on the fly via response out stream.


we are dynamically generating a zip file on  fly with no compression and serving it down over http. However since the length of zip  is not known, we set a content length of -1.

Now our zip is essentially zip headers + the whole file since we do not compress, so is there a way to determine the size of the entire zip file by some math on headers + file content size without generating the whole file ahead of time?