Skip to content

Instantly share code, notes, and snippets.

@whistler
Created September 18, 2011 04:35
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 whistler/1224731 to your computer and use it in GitHub Desktop.
Save whistler/1224731 to your computer and use it in GitHub Desktop.
Download and Save File using Ruby
#smallest, cleanest code i have seen without curl
require 'open-uri'
open("http://someplace.com/somefile.mp3") do |in_io|
File.open("somefile.mp3", 'w') do |out_io|
out_io.print in_io.read
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment