Created
December 27, 2015 01:58
-
-
Save notblizzard/ad92f2c0320f879f202a to your computer and use it in GitHub Desktop.
This file contains 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' | |
require 'open-uri' | |
file_name = "hello.tar.gz" | |
download_url = "https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz" | |
File.open(file_name, "wb") do |f| | |
f.write(Zlib::GzipReader.new(open(download_url)).read) | |
end | |
File.open(file_name, "r") do |f| | |
g = Zlib::GzipReader.open(f) | |
puts g.read | |
g.close | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment