Description
Down is a Ruby library for downloading remote files in a streaming, flexible and safe way. It can use open-uri with Net::HTTP, http.rb or HTTPX as the HTTP backend. The main method, Down.download, saves the remote file to a Tempfile and adds metadata taken from the response. When you accept URLs from outside sources, a max_size option stops the download as soon as the Content-Length header shows the file is too large, or as soon as the downloaded data passes the limit if that header is missing. You can save straight to a chosen destination, keep the tempfile with a different extension or prefix, and let it apply HTTP basic authentication found in the URL. Callbacks report the content length and download progress. It is aimed at Ruby developers who handle file uploads by URL or other remote downloads.…
Highlights
- Backends: open-uri with Net::HTTP, http.rb or HTTPX
- Downloads to a Tempfile with response metadata
- max_size option that aborts oversized downloads early
- Custom destination, extension and tempfile prefix
- Basic auth from the URL and progress callbacks
Ratings & Reviews
No ratings yet
Be the first to rate Down.
People also visit
Down FAQ
What is Down?
A Ruby gem for streaming and safely downloading remote files, with a choice of HTTP backends.
Which HTTP libraries does it support?
open-uri with Net::HTTP, http.rb, or HTTPX.
How does it protect against very large files?
Pass :max_size. Down stops as soon as the Content-Length header exceeds the limit, or once the downloaded content goes past it when the header is missing.
Can I save the file to a specific path?
Yes, use the :destination option. By default the file is returned as a Tempfile.
Can I track download progress?
Yes. :content_length_proc is called with the Content-Length value and :progress_proc with the current size as data arrives.
What are the best Down alternatives?
Popular alternatives to Down include Confluence and Smart Open. See all Down alternatives

