Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- download_file = File.open(temp_file, 'wb')
- request.on_headers do |response|
- if !response.success?
- raise "Request failed."
- end
- end
- request.on_body do |response, chunk|
- download_file.write(chunk)
- end
- request.on_complete do |response|
- download_file.close
- end
- request.run
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement