Skip to content

Instantly share code, notes, and snippets.

@chopmo
Created November 2, 2010 13:28
Show Gist options
  • Save chopmo/659602 to your computer and use it in GitHub Desktop.
Save chopmo/659602 to your computer and use it in GitHub Desktop.
require 'net/http'
Net::HTTP.start("multimedia.pol.dk") { |http|
resp = http.get("/archive/00493/Greece_Mail_Bombs_493553y.jpg")
open("foo.jpg", "wb") { |file|
file.write(resp.body)
}
}
@sirupsen
Copy link

sirupsen commented Nov 2, 2010

require ‘open-uri’
open("foo.jpg", “wb”) do |f|
  f.write(open("http://sirupsen.com/").read)
end

@chopmo
Copy link
Author

chopmo commented Nov 3, 2010

Even better, yes :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment