Fetches IP-to-ASN data over HTTP(S) into a file, only when it changed.
Uses OTP's :httpc, so it needs no dependency. HTTPS certificates are
verified against the operating system's trusted certificates
(:public_key.cacerts_get/0), hostname included. The request asks for the
data only if it changed since the given time (If-Modified-Since); the
body is streamed straight to the file, never held in memory.
Summary
Types
:updated when the file now holds new data, :unchanged when the server
had nothing newer.
Functions
Downloads url into path if it changed since modified_since
(milliseconds since the epoch, or nil to download unconditionally).
Types
@type result() :: :updated | :unchanged | {:error, term()}
:updated when the file now holds new data, :unchanged when the server
had nothing newer.
Functions
@spec fetch(String.t(), Path.t(), integer() | nil, pos_integer()) :: result()
Downloads url into path if it changed since modified_since
(milliseconds since the epoch, or nil to download unconditionally).