For the url you may need the rest-client from its doc
If you want to transfer the data from the response to the file as it arrives, and not completely into memory, you can also pass the RestClient :: Request.execute parameter: block_response to which you pass the /proc.This block, the block receives the original unmodified Net :: object. HTTPResponse from Net :: HTTP, which you can use to stream directly to a file when receiving each fragment.
File.open('/some/output/file', 'w') {|f| block = proc { |response| response.read_body do |chunk| f.write chunk end } RestClient::Request.execute(method: :get, url: 'http://example.com/some/really/big/file.img', block_response: block) }
fangxing Jun 01 '17 at 16:59 on 2017-06-01 16:59
source share