Skip to content

Instantly share code, notes, and snippets.

@joswr1ght
Last active January 21, 2019 18:28
Show Gist options
  • Save joswr1ght/a400f2648569003f555f6b3a467acb7c to your computer and use it in GitHub Desktop.
Save joswr1ght/a400f2648569003f555f6b3a467acb7c to your computer and use it in GitHub Desktop.
Zlib decompress file, producing file.out
#!/usr/bin/env python
import zlib, sys
if len(sys.argv) != 2:
print "Usage: %s <zlib-compressed-file>"%sys.argv[0]
print "Produces decompressed file with \".out\" filename suffix."
sys.exit(0)
indata=open(sys.argv[1], "rb").read()
outdata=zlib.decompress(indata)
with open(sys.argv[1] + ".out", "wb") as f:
f.write(outdata)
f.close()
@OlivierLaflamme
Copy link

Traceback (most recent call last):
File "./zunzip.py", line 10, in
outdata=zlib.decompress(indata)
zlib.error: Error -3 while decompressing data: incorrect data check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment