Created
January 22, 2017 02:35
-
-
Save sentientmonkey/4e6468cb7b5c43fe300bba4d4aacb072 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "zlib" | |
data = "the quick brown fox jumps over the lazy dog\n" | |
compressed_data = Zlib::Deflate.deflate data | |
File.write("saved_compressed_data", compressed_data) | |
read_compressed_data = File.read("saved_compressed_data") | |
a,b = read_compressed_data.bytes[0..1] | |
puts "%02x %02x" % [a, b] | |
puts "Compressed" if 0x78 == a |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment