Skip to content

Instantly share code, notes, and snippets.

@blizzarddreams
Last active December 27, 2015 01:54
Show Gist options
  • Select an option

  • Save blizzarddreams/5d0f5f406731911ac467 to your computer and use it in GitHub Desktop.

Select an option

Save blizzarddreams/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