Created
September 18, 2011 04:35
-
-
Save whistler/1224731 to your computer and use it in GitHub Desktop.
Download and Save File using Ruby
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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