Down - library for streaming and safer downloads


I’ve just published Down, an HTTP wrapper for streaming and safer downloads.

The main features are:"", max_size: 5 * 1024 * 1024) # 5 MB
{:error, :too_large}

iex>"") |> Enum.find_value(&\<title\>(.*)\<\/title\>/i, &1, capture: :all_but_first))

It is compatible with :hackney, :httpc, :ibrowser and Mint. All of them are optional dependencies.

You can find more information in

The code:

The package is in alpha state, but it works fine. I’d like to add a couple of features and to improve the tests and the documentation. Suggestions–I don’t have experience publishing libraries–and help are very welcomed.

I hope you enjoy it :slight_smile:


Am I correct in guessing that streaming with Mint is complicated by the socket behavior being active?

With :hackney, :httpc and :ibrowse I can pause the stream at any moment, so they are perfect if you want to analyze the remote file slowly. I couldn’t do the same with Mint for the moment.

Yeah, I’ve also been struggling with that recently.

Best solution I’ve come up with thus far is to queue the chunks up in a way that can be demanded by the stream.

I did see that there are a couple places in Mint where they set the socket to {:active, :once}, so there might be a way to do that and drive the process more like you can in the other libs.

I want to do the same! I want to implement a buffer, but with a max_buffer size tough. I’ll need to stop the download to have a right behaviour with Mint backend.

This is a question I wanted to ask to Mint developers. Maybe can @ericmj tell us if this will be a feature in a future release? :slight_smile:

1 Like

Or maybe @whatyouhide can speak to it?

With Mint we set active: :once so it is streaming already. If you don’t call on a TCP/SSL message, we won’t set active: :once again so effectively you can block already. If you want to actually stop receiving stuff from the socket, then you should set active: false but we don’t support doing that through Mint yet. Is that what you mean?


This might just be a misunderstanding then.

Since the docs say:

The connection socket runs in active mode

My assumption was that it’s run in {:active, true}, not {:active, once}. I believe this used to be the case?

1 Like

I don’t believe we ever used active: true. I’ll fix the docs to clarify this later today.


Sounds good, thanks!

Looks like it moved from active: true to active: :once six months ago.

Edit: Which apparently I should have remembered because there’s a record of me talking about it in my company Slack when it happened. :smiley: