Skip to content

Instantly share code, notes, and snippets.

@nahi
Created August 23, 2011 15:31
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 nahi/1165455 to your computer and use it in GitHub Desktop.
Save nahi/1165455 to your computer and use it in GitHub Desktop.
% cat z.rb
require 'zlib'
GZIP_CONTENT = "\x1f\x8b\x08\x00\x1a\x96\xe0\x4c\x00\x03\xcb\x48\xcd\xc9\xc9\x07\x00\x86\xa6\x10\x36\x05\x00\x00\x00"
DEFLATE_CONTENT = "\x78\x9c\xcb\x48\xcd\xc9\xc9\x07\x00\x06\x2c\x02\x15"
z = Zlib::Inflate.new(Zlib::MAX_WBITS + 32)
p z.inflate(GZIP_CONTENT)
z.reset
p z.inflate(DEFLATE_CONTENT)
% jruby z.rb
"hello"
"hello"
% ruby z.rb
"hello"
"hello"
%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment