Down 3.0.0 released with HTTP.rb backend

27 views
Skip to first unread message

Janko Marohnić

unread,
May 23, 2017, 11:29:33 PM5/23/17
to http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API
Hello,

I just wanted to let you know that I've released a new major version of Down – a Ruby library for file downloads – with a new HTTP.rb backend (as opposed to the default open-uri + Net::HTTP backend).

For those of you who don't know, the idea behind Down was to have a library for streaming downloads, I created it mainly so that I can use it in Shrine. Down comes with two main utility methods – `Down.download` and `Down.open`. `Down.download` downloads the remote file to disk in a memory-efficient way, and `Down.open` returns an IO-like object representing the remote file which is downloaded on-demand.

tempfile = Down.download("http://example.org/image.jpg") # downloads the whole file
tempfile
.path #=> #<File:/var/folders/k7/6zx6dx6x7ys3rv3srh0nyfj00000gn/T/20170524-56104-c5wpmj.jpg>

io
= Down.open("http://example.org/image.jpg") # downloads only the headers
io
.read(1024*1024) # downloads and returns the first 1MB
io
.read(1024*1024) # downloads and returns the next 1MB
io
.rewind
io
.read(1024*1024) # returns the first 1MB of cached content

I wanted to take this opportunity to express my gratitude to Tony, Alexey and other maintainers of the HTTP.rb library, I found HTTP.rb to be a breath of fresh air, not just in comparison to Net::HTTP but in comparison to all other HTTP libraries that I've used. Some of the features that really shined when I was implementing the HTTP.rb backend in Down:
  • Streaming downloads!
  • Correct URI parsing with Addressable::URI
  • Chainable HTTP client builder interface
  • Ability to retrieve response headers in non-normalized form
  • Following redirects with a limit to number of redirects (open-uri can follow but you cannot specify a limit)
Anyway, thank you!

Kind regards,
Janko

Tony Arcieri

unread,
May 24, 2017, 7:54:39 AM5/24/17
to Janko Marohnić, http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API
Glad to hear such a glowing success report!

--
You received this message because you are subscribed to the Google Groups "http.rb: a fast, easy-to-use Ruby HTTP client with a chainable API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to httprb+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Tony Arcieri
Reply all
Reply to author
Forward
0 new messages