Using gzip, tell() returns the offset in the uncompressed file.
In order to show a progress bar, I want to know the original (uncompressed) size of the file.
Is there an easy way to find out?
Using gzip, tell() returns the offset in the uncompressed file. In order to show
Share
The gzip format specifies a field called
ISIZEthat:In gzip.py, which I assume is what you’re using for gzip support, there is a method called
_read_eofdefined as such:There you can see that the
ISIZEfield is being read, but only to to compare it toself.sizefor error detection. This then should mean thatGzipFile.sizestores the actual uncompressed size. However, I think it’s not exposed publicly, so you might have to hack it in to expose it. Not so sure, sorry.I just looked all of this up right now, and I haven’t tried it so I could be wrong. I hope this is of some use to you. Sorry if I misunderstood your question.