Getting the original filename form gzip archive in Python (compatible with Python 3.6, 3.7 and 3.8).
from github directly:
pip install git+https://github.com/PierreSelim/gzinfo.git
If you gzip a file called foo.txt
and rename the archive bar.txt
you can
still retrive the original name from the header (per
RFC1952)
>>> import gzinfo
>>> info = gzinfo.read_gz_info('bar.txt.gz')
>>> info.fname
'foo.txt'