Download this source
require 'zlib'
str = """This is a bit of sample text. It's just trying really to be
a pretty standard thing with some space layout and what have you.
S'all good..."""
zipped = Zlib::Deflate.deflate(str)
# Don't print 'em, because the zipped will be binary and will
# chew up your terminal.
puts "Original: #{str.length} chars"
puts "Zipped : #{zipped.length} chars"
puts Zlib::Inflate.inflate(zipped)
Running this outputs:
Original: 168 chars
Zipped : 123 chars
This is a bit of sample text. It's just trying really to be
a pretty standard thing with some space layout and what have you.
S'all good...

