A Rust library for fast, reliable asynchronous file downloading.
0xDL provides a clean, minimal abstraction for downloading large files over HTTP/S using asynchronous Rust.
Built on Tokio and reqwest, it offers:
- High‑performance async streaming
- Optional progress callbacks
- Optional SHA‑256 verification with guaranteed cleanup on failure
- Atomic final file placement
Install 0xDL using Cargo:
cargo add oxdlOr add it manually to Cargo.toml:
[dependencies]
oxdl = "0.1.5"- Fully asynchronous file downloads
- Optional
Fn(f32)progress callbacks - Optional SHA‑256 integrity verification
- Automatic cleanup of failed downloads
- Atomic final file write
0xDL exposes two high‑level functions.
use oxdl::download;
#[tokio::main]
async fn main() -> Result<(), oxdl::DownloadError> {
let url = "https://example.com/file.iso";
let path = "file.iso";
download(url, path, None).await?;
Ok(())
}use oxdl::download_with_updates;
#[tokio::main]
async fn main() -> Result<(), oxdl::DownloadError> {
let url = "https://example.com/file.iso";
let path = "file.iso";
let progress = |pct: f32| println!("Progress: {:.1}%", pct);
download_with_updates(url, path, Some(Box::new(progress)), None).await?;
Ok(())
}| Function | Progress | SHA‑256 | Use Case |
|---|---|---|---|
download |
❌ | ✔ optional | Simple fire‑and‑forget download |
download_with_updates |
✔ optional | ✔ optional | UI/CLI progress + integrity checks |
If SHA‑256 validation fails, 0xDL automatically deletes the temporary file.
Advanced users may construct a downloader manually.
use oxdl::Downloader;
let dl = Downloader::new("https://example.com/file.iso", "file.iso")?
.on_update(|p| println!("{p:.1}%"))
.with_sha256("deadbeef...")?;
dl.execute().await?;| Method | Description |
|---|---|
new(url, path) |
Validates and constructs a downloader |
on_update(f) |
Sets a callback receiving progress 0–100% |
with_sha256(hex) |
Enables SHA‑256 verification |
execute() |
Performs the full download |
- Rust stable
- Linux, macOS, Windows
0xDL organizes tests using features so expensive tests only run when requested.
| Feature | Includes |
|---|---|
tests |
Offline unit tests |
net-tests |
Real HTTP downloads |
dl-iso-test |
Large (>1GB) ISO stress test |
all-tests |
tests + net-tests |
all-tests-w-iso-dl |
everything including large ISO test |
cargo test --features testscargo test --features net-testscargo test --features all-testscargo test --features all-tests-w-iso-dl -- --nocapturecargo test --features dl-iso-test -- --nocaptureMIT
PRs welcome.
Created by Anthony Tropeano — https://github.com/iitoneloc