Method: Lhj::Command::OSS::Download#download_file

Defined in:
lib/lhj/command/oss/download.rb

#download_file(url, file) ⇒ Object



86
87
88
89
90
91
92
# File 'lib/lhj/command/oss/download.rb', line 86

def download_file(url, file)
  http_client = Faraday.new do |c|
    c.adapter Faraday.default_adapter
  end
  response = http_client.get(url)
  File.open(file, 'wb') { |fp| fp.write(response.body) }
end