Skip to content

Instantly share code, notes, and snippets.

@jldailey
Created June 3, 2010 18:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jldailey/424258 to your computer and use it in GitHub Desktop.
Save jldailey/424258 to your computer and use it in GitHub Desktop.
def manual_gzip(data, cache_file=None):
_header = ("\037\213\010\000" # magic, type, flags
"\000\000\000\000" # mtime
"\002\377") # xfl, os
co = zlib.compressobj()
return ''.join([_header, co.compress(data)[2:], co.flush()])
# struct.pack("<ll",zlib.crc32(data),len(data))])
@hoisie
Copy link

hoisie commented Jun 3, 2010

Very useful stuff, thanks!

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