Is there any reliable way of getting the uncompressed length of a compressed string (specifically compressed with GZIP) without decompressing the string? I have no control over the compression process, i.e. no agreed upon flags or tail data. I've read you can check the four last bytes, but that seem to require flags to be enabled which, again, I have no control over.
Asked
Active
Viewed 367 times
-1
-
See https://superuser.com/a/828300/85927 – Jonathan Hall Jan 21 '21 at 14:40
-
This does not answer my question. I need a reliable (read: tool independent, based only on the compression method) way to do this. – gwow12345 Jan 21 '21 at 15:01
-
It provides as much of an answer as is possible without seeing your actual gzip string. TL;DR; the gzip stream itself does not contain the information you require. But if your stream includes a header, it might. – Jonathan Hall Jan 21 '21 at 15:02
-
This answers my question. Thanks. Add it as an answer if you'd like me to accept it. – gwow12345 Jan 21 '21 at 15:05
-
See https://stackoverflow.com/a/9727599/1180620 . – Mark Adler Jan 21 '21 at 20:23
1 Answers
0
The gzip stream itself does not contain the information you require. But if your stream includes a header, it might.
More info here.

Jonathan Hall
- 75,165
- 16
- 143
- 189