Created
January 5, 2011 17:06
-
-
Save jonathandean/766600 to your computer and use it in GitHub Desktop.
Ruby remote file download
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
require 'net/http' | |
Net::HTTP.start('www.example.com') { |http| | |
resp = http.get('/url/to/file.ext') | |
open('/path/to/local/file.ext', "wb") { |file| | |
file.write(resp.body) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment