Class: GrubY::FileStream
- Inherits:
-
Object
- Object
- GrubY::FileStream
- Defined in:
- lib/gruubY/file_stream.rb
Class Method Summary collapse
Class Method Details
.download(url, dest) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/gruubY/file_stream.rb', line 5 def self.download(url, dest) uri = URI(url) Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http| http.request_get(uri) do |res| File.open(dest, "wb") do |f| res.read_body { |chunk| f.write(chunk) } end end end end |