View Source locus_http_download (locus v2.3.6)

Downloads a file using HTTP(S) without blocking the caller

Link to this section Summary

Link to this section Types

Specs

body() :: binary().

Specs

Link to this type

event_download_dismissed/0

View Source

Specs

event_download_dismissed() :: {download_dismissed, full_http_response()}.
Link to this type

event_download_failed_to_start/0

View Source

Specs

event_download_failed_to_start() ::
    {download_failed_to_start, reason_for_download_failing_to_start()}.
Link to this type

event_download_finished/0

View Source

Specs

event_download_finished() ::
    {download_finished, BodySize :: non_neg_integer(), {ok, TrailingHeaders :: headers()}} |
    {download_finished, BodySize :: non_neg_integer(), {error, term()}} |
    {download_finished, BodySize :: non_neg_integer(), {error, timeout}}.
Link to this type

event_download_redirected/0

View Source

Specs

event_download_redirected() :: {download_redirected, redirection()}.
Link to this type

event_download_started/0

View Source

Specs

event_download_started() :: {download_started, headers()}.

Specs

event_request_sent() :: {request_sent, url(), headers()}.

Specs

full_http_response() :: {http, response_status(), headers(), body()}.

Specs

headers() :: [{string(), string()}].

Specs

msg() ::
    {event, event()} |
    {finished, {success, success()}} |
    {finished, dismissed} |
    {finished, {error, term()}}.

Specs

opt() ::
    {connect_timeout, timeout()} |
    {download_start_timeout, timeout()} |
    {idle_download_timeout, timeout()} |
    insecure |
    {insecure, boolean()} |
    {censor_query, CensoredKeys :: [atom()]}.
Link to this type

reason_for_download_failing_to_start/0

View Source

Specs

reason_for_download_failing_to_start() ::
    full_http_response() |
    too_many_redirections |
    {invalid_redirection, term()} |
    {error, term()} |
    timeout.

Specs

redirection() :: #{url := url(), permanence := permanent | temporary}.

Specs

response_status() :: {100..999, binary()}.

Specs

state() :: #state{}.

Specs

success() :: #{headers := headers(), body := binary()}.

Specs

url() :: string().