Skip to content

Instantly share code, notes, and snippets.

@notblizzard
Last active December 27, 2015 01:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save notblizzard/5d0f5f406731911ac467 to your computer and use it in GitHub Desktop.
Save notblizzard/5d0f5f406731911ac467 to your computer and use it in GitHub Desktop.
require 'zlib'
require 'open-uri'
file_name = "hello.tar.gz"
download_url = "https://storage.googleapis.com/golang/go1.5.2.linux-amd64.tar.gz"
File.open(file_name, "wb") do |f|
f.write(Zlib::GzipReader.new(open(download_url)).read)
end
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