Ruby: uncompress zlib-wrapped deflate data -
in ruby, have buffer containing data compressed zlib compress2()
method. found no way decompress data using zlib functionality in ruby standard library supports data created deflate
or data in gzip format.
how can achieve equivalent of uncompress()
in ruby, preferably without resorting creating custom c-extension?
edit:
i found solution. after fiddling around window_bits
argument inflate
constructor without success, understood zlib prefixes compressed data four-byte header. removed header , worked charm:
data[0..3] = '' data = zlib::inflate.inflate(data)
the documentation indicates ruby inflate class decompress output of compress2(), in zlib format. tried it, , works fine. compressed data may not making on ruby intact.
Comments
Post a Comment