Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 446417
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:28:07+00:00 2026-05-12T21:28:07+00:00

Using gzip, tell() returns the offset in the uncompressed file. In order to show

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T21:28:08+00:00Added an answer on May 12, 2026 at 9:28 pm

    The gzip format specifies a field called ISIZE that:

    This contains the size of the original (uncompressed) input data modulo 2^32.

    In gzip.py, which I assume is what you’re using for gzip support, there is a method called _read_eof defined as such:

    def _read_eof(self):
        # We've read to the end of the file, so we have to rewind in order
        # to reread the 8 bytes containing the CRC and the file size.
        # We check the that the computed CRC and size of the
        # uncompressed data matches the stored values.  Note that the size
        # stored is the true file size mod 2**32.
        self.fileobj.seek(-8, 1)
        crc32 = read32(self.fileobj)
        isize = U32(read32(self.fileobj))   # may exceed 2GB
        if U32(crc32) != U32(self.crc):
            raise IOError, "CRC check failed"
        elif isize != LOWU32(self.size):
            raise IOError, "Incorrect length of data produced"
    

    There you can see that the ISIZE field is being read, but only to to compare it to self.size for error detection. This then should mean that GzipFile.size stores 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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

You might know that HTML related file formats are compressed using GZip compression, server
I need to compress a file using GZip by batch of specified size (not
Using Google App Engine, I am trying to urlfetch a gzip file from a
i´m using GZipStream to gzip string. Can someone tell me if it is possible
I need an example for compressing a string using GZip in android. I want
I've gziped my JavaScript file using gzip and uploaded it to Amazon S3. I've
I am trying to encode a list as JSON, compress it using gzip in
I'm compressing a string with Gzip using this code: public static String Compress(String decompressed)
I plan to configure weblogic's gzip servlet filter (using weblogicx-gzip.jar) to gzip my web
Note: I had another similar question about how to GZIP data using Ruby's zlib

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.