| Crates.io | robust_downloader |
| lib.rs | robust_downloader |
| version | 0.0.16 |
| created_at | 2025-04-04 19:32:19.685221+00 |
| updated_at | 2025-07-24 11:55:20.506215+00 |
| description | A robust, concurrent file downloader with retry capabilities and progress tracking. |
| homepage | |
| repository | https://github.com/ityuany/robust_downloader |
| max_upload_size | |
| id | 1620655 |
| size | 81,794 |
A robust, concurrent file downloader library for Rust with progress tracking and retry capabilities.
Add this to your Cargo.toml:
[dependencies]
# Default features (includes SHA2 and SHA3)
robust_downloader = "0.0.6"
# Or with specific hash algorithms
robust_downloader = { version = "0.0.6", features = ["sha2", "blake3"] }
# Or with modern/secure algorithms
robust_downloader = { version = "0.0.6", features = ["modern"] }
# Or with all hash algorithms
robust_downloader = { version = "0.0.6", features = ["all"] }
use robust_downloader::{RobustDownloader, Integrity, DownloadItem};
use std::time::Duration;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create a downloader with custom configuration
let downloader = RobustDownloader::builder()
.max_concurrent(4) // Set max concurrent downloads
.connect_timeout(Duration::from_secs(5)) // Set connection timeout
.build();
// Define download tasks with integrity verification
let downloads = vec![
DownloadItem::builder()
.url("https://example.com/file1.zip")
.target("file1.zip")
.integrity(Integrity::SHA256("e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855".into()))
.build(),
DownloadItem::builder()
.url("https://example.com/file2.zip")
.target("file2.zip")
.integrity(Integrity::Blake3("202020202020202020202020".into()))
.build(),
];
// Start downloading
downloader.download(downloads).await?;
Ok(())
}
| Option | Default | Description |
|---|---|---|
max_concurrent |
2 | Maximum number of concurrent downloads |
connect_timeout |
2s | Connection timeout for each request |
timeout |
60s | Overall timeout for each download |
flush_threshold |
512KB | Buffer size for writing to disk |
Available hash algorithm features:
md5 - Enable MD5 hash supportsha1 - Enable SHA1 hash supportsha2 - Enable SHA256 and SHA512 support (included in default)sha3 - Enable SHA3-256 hash support (included in default)blake2 - Enable BLAKE2b and BLAKE2s supportblake3 - Enable BLAKE3 hash supportFeature combinations:
modern - Enable modern/secure algorithms (sha2, sha3, blake2, blake3)legacy - Enable legacy algorithms (md5, sha1)all - Enable all hash algorithmsThe library provides detailed progress tracking with:
The library requires Rust 1.75 or later.
cargo add robust_downloader
This project is licensed under the MIT License - see the LICENSE file for details.