If you ever need to unzip data compressed with zlib without a header (e.g. produced by Erlang’s zlib:zip), it pays to be aware that
windowBits can also be -8..-15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream. (zlib.h)
Hence, you can do something like
<cr:code lang=“ruby”> zs = Zlib::Inflate.new(-15) unzipped = zs.inflate(string) zs.finish zs.close </cr:code>
Post a Comment