Skip to content

Instantly share code, notes, and snippets.

View aaron-lane's full-sized avatar
😶‍🌫️
Engineering the release of clouds!

Aaron Lane aaron-lane

😶‍🌫️
Engineering the release of clouds!
View GitHub Profile
@janko
janko / 01-safe-download.rb
Last active January 9, 2023 11:40
A safe way in Ruby to download a file to disk using open-uri (with/without comments)
require "open-uri"
require "net/http"
Error = Class.new(StandardError)
DOWNLOAD_ERRORS = [
SocketError,
OpenURI::HTTPError,
RuntimeError,
URI::InvalidURIError,