Since expanding a large gzip file takes quite long time (sometimes over half a minute), I'd like to know the expanded size before I start the expansion (for progression report purpose). Is there a way of knowing it without actually expanding?
Update:
For file larger than 4G bytes (expanded size), there's no sure way of knowing the size without actually expanding the gzip file. However, for files smaller than 4G bytes (expanded size), the actual expanded size is stored as the last 4 bytes of the gzip file and could be retrieved easily:
(1..4).inject(0) do |v, i|
v += IO.read(file_name, 1, original_size - i)[0] * (2**8) ** (4 - i)
end