download

Ruby: how to download zip files

How to download zip files with ruby

Here is the example that gave me the solution:

require 'net/http'
 
Net::HTTP.start("static.flickr.com") { |http|
  resp = http.get("/92/218926700_ecedc5fef7_o.jpg")
  open("fun.jpg", "wb") { |file|
    file.write(resp.body)
   }
}
puts "Yay!!"

http://snippets.dzone.com/posts/show/2469

Thanks!

Here is my adaptation since I was using httpclient

stream = client.get_content(zipURL)
file = open("test", "wb")
file.write(stream)
file.close

Syndicate content