fast-down
fast-down is a fast, concurrent file downloader library built on top of the
fast_pull pull/push engine, with first-class
HTTP support.
Official Website (Simplified Chinese)
What this crate provides
fast-down re-exports the entire fast_pull
pull/push engine (the download_single / download_multi entry points, the Puller
and Pusher traits, and the file/memory pushers) and adds the following on top of it:
- HTTP / reqwest puller —
FastDownPuller(withFastDownPullerOptions) is the defaultPullerfor HTTP(S) sources. It builds on aSmartRedirectClientthat follows redirects manually so it can honor theReferrer-Policyheader and strip resource-specific headers (Origin/Authorization/Cookie) on cross-origin hops, per RFC 9110 §15.4. - URL info resolution —
UrlInfoandFileIdcapture a resource's size, suggested filename, content type, range support, and a stable identity derived from theETag/Last-Modifiedheaders, which powers incremental and resumable downloads. - Proxy support — the
Proxyenum selects no proxy, the system proxy, or a custom proxy URL for outgoing requests. - Result + event stream — download functions return a
DownloadResultwhoseevent_chainreceiver disconnects once the pipeline has fully flushed; awaiting that disconnect is the completion signal (no separate join handle).
Supporting building blocks (behind feature flags) include the backend-agnostic
http module (HttpClient traits, HttpPuller, Prefetch, ContentDisposition,
HttpError) and the reqwest module (SmartRedirectClient,
ManualRedirectRequestBuilder).
Example
Download a file concurrently to disk. This requires the fast-puller feature
(which also enables reqwest and http), the file feature, and a network
connection, so the block is marked no_run to compile it without making a real
network request. The fallback main keeps the example compilable when rustdoc
checks a feature combination that does not provide those APIs:
async
For a sequential, single-threaded download, swap download_multi for
fast_pull::single::download_single and use fast_pull::single::DownloadOptions
(which only has retry_gap and push_queue_cap).