Expand description
A powerful and flexible file downloader library with parallel downloads, resumable downloads, progress tracking, and desktop notifications.
§Features
- Parallel downloads: Split large files into chunks and download concurrently
- Resumable downloads: Continue interrupted downloads from where they left off
- Progress tracking: Visual progress bars with download statistics
- Desktop notifications: Get notified when downloads complete or fail
- File-based batch downloads: Download multiple files from a list
- Configurable concurrency: Control number of workers and parallel files
§Quick Start
use dwrs::{Downloader, DownloadConfig};
use std::path::PathBuf;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> {
// Initialize logging
dwrs::init();
// Create downloader with default config
let downloader = Downloader::new_default();
// Download a single file
downloader.download_file(
"https://example.com/file.zip",
PathBuf::from("file.zip")
).await?;
Ok(())
}§Configuration
Use DownloadConfig to customize behavior:
use dwrs::DownloadConfig;
let config = DownloadConfig {
workers: 8, // Parallel chunks per file
buffer_size: 512 * 1024, // 512KB buffer
retries: 5, // Retry failed downloads
..Default::default()
};Re-exports§
pub use download::download_file;pub use file_parser::parse_file;pub use notifications::notify_send;pub use notifications::spawn_background_process;
Modules§
Structs§
- Download
Config - Configuration for download operations.
- Downloader
- Main downloader struct managing HTTP client and configuration.
Functions§
- create_
optimized_ client - Creates an optimized HTTP client with connection pooling and compression.
- init
- Initializes the library logging system.