Skip to content

Instantly share code, notes, and snippets.

@jldailey
Created June 3, 2010 18:19
Show Gist options
  • Select an option

  • Save jldailey/424258 to your computer and use it in GitHub Desktop.

Select an option

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

hoisie commented Jun 3, 2010

Copy link
Copy Markdown

Very useful stuff, thanks!

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