Skip to content

Instantly share code, notes, and snippets.

@jonathandean
Created January 5, 2011 17:06
Show Gist options
  • Save jonathandean/766600 to your computer and use it in GitHub Desktop.
Save jonathandean/766600 to your computer and use it in GitHub Desktop.
Ruby remote file download
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