Skip to content

Instantly share code, notes, and snippets.

@mikelopez
Created November 21, 2013 01:58
Show Gist options
  • Save mikelopez/7574840 to your computer and use it in GitHub Desktop.
Save mikelopez/7574840 to your computer and use it in GitHub Desktop.
Download binary file through HTTP
require 'open-uri'
File.open("/my/local/path/sample.flv", "wb") do |saved_file|
# the following "open" is provided by open-uri
open("http://somedomain.net/flv/sample/sample.flv", 'rb') do |read_file|
saved_file.write(read_file.read)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment