deflate

Zlib.deflate(string[, level])
Zlib::Deflate.deflate(string[, level])
Class Public methods

Compresses the given string. Valid values of level are Zlib::NO_COMPRESSION, Zlib::BEST_SPEED, Zlib::BEST_COMPRESSION, Zlib::DEFAULT_COMPRESSION, or an integer from 0 to 9 (the default is 6).

This method is almost equivalent to the following code:

def deflate(string, level)
  z = Zlib::Deflate.new(level)
  dst = z.deflate(string, Zlib::FINISH)
  z.close
  dst
end

See also Zlib.inflate

doc_ruby_on_rails
2015-06-14 12:51:00
Comments
Leave a Comment

Please login to continue.