Crates.io | ml-downloader |
lib.rs | ml-downloader |
version | 0.1.1 |
source | src |
created_at | 2022-02-27 17:13:15.975796 |
updated_at | 2023-08-18 13:23:35.488685 |
description | Simple blocking downloader based on reqwest |
homepage | |
repository | https://github.com/malaire/ml-downloader |
max_upload_size | |
id | 540439 |
size | 18,261 |
Simple blocking downloader, featuring:
Create Downloader
with default configuration and then download one file.
use ml_downloader::Downloader;
let mut downloader = Downloader::new()?;
let bytes = downloader.get("https://example.com/").send()?;
# Ok::<(), ml_downloader::Error>(())
Create Downloader
with
"foobar/1.0"
as USER_AGENT
1.0 - 1.1
seconds interval between successful downloads2.0 - 2.2
seconds delay after initial failure5.0 - 5.5
seconds delay after 2nd failureuse ml_downloader::Downloader;
let mut downloader = Downloader::builder()
.reqwest(|cb| cb.user_agent("foobar/1.0"))
.interval(1.0, 1.1)
.retry_delays(&[(2.0, 2.2), (5.0, 5.5)])
.build()?;
# Ok::<(), ml_downloader::Error>(())