{"id":51041760,"url":"https://github.com/catannadev/async_downloader","last_synced_at":"2026-06-22T11:01:17.259Z","repository":{"id":362806509,"uuid":"1260907891","full_name":"CatAnnaDev/async_downloader","owner":"CatAnnaDev","description":null,"archived":false,"fork":false,"pushed_at":"2026-06-06T02:52:39.000Z","size":0,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-06-06T03:06:46.693Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CatAnnaDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-06T02:32:56.000Z","updated_at":"2026-06-06T02:52:43.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/CatAnnaDev/async_downloader","commit_stats":null,"previous_names":["catannadev/async_downloader"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/CatAnnaDev/async_downloader","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatAnnaDev%2Fasync_downloader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatAnnaDev%2Fasync_downloader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatAnnaDev%2Fasync_downloader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatAnnaDev%2Fasync_downloader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CatAnnaDev","download_url":"https://codeload.github.com/CatAnnaDev/async_downloader/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CatAnnaDev%2Fasync_downloader/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34645688,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-22T02:00:06.391Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-22T11:01:16.210Z","updated_at":"2026-06-22T11:01:17.244Z","avatar_url":"https://github.com/CatAnnaDev.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# async_downloader\n\nAsync file downloader for Rust GUIs. The engine runs on its own multi-threaded\nTokio runtime and never blocks the UI thread; the interface only reads progress\nand sends control commands.\n\nIt is UI-agnostic at its core, with optional ready-made integrations for `egui`\nand `iced` behind feature flags.\n\n## Features\n\n- Prespawned worker pool: workers are spawned once and wait on a queue, so the\n  reqwest connection pool stays warm and there is no per-download task spawn cost.\n- Queue with a concurrency limit: the number of workers is the number of\n  simultaneous downloads.\n- Per-file pause, resume and cancel.\n- HTTP range resume: an interrupted or paused transfer continues from the bytes\n  already on disk using a `Range` request.\n- SHA-256 verification: the finished file is re-read from disk and hashed,\n  optionally compared against an expected digest.\n- Live download speed, computed once in the engine and exposed to every UI.\n- Batch downloads: enqueue a whole pack of files as one unit and read aggregate\n  progress (files done, total bytes, combined speed) plus group controls. A\n  single archive is just one job; a launcher-style set of files is one batch.\n\n## Async model\n\n`Downloader::new` builds a Tokio multi-threaded runtime and immediately spawns\n`max_concurrent` worker tasks. `enqueue` pushes a `Job` onto an async MPMC queue\nand returns a cheap, clonable `Download` handle. Workers pull jobs, stream the\nbody chunk by chunk with `reqwest` + `futures`, and publish state through a\n`tokio::sync::watch` channel.\n\nThe UI never awaits anything. It reads `download.progress()` whenever it\nrepaints, and calls `pause` / `resume` / `cancel`, which set an atomic command\nthe worker observes between chunks. Two independent knobs: `Threads` controls\nthe runtime worker threads (`Auto` or `Fixed(n)`), `max_concurrent` controls how\nmany downloads run at once.\n\n## Install\n\n```toml\n[dependencies]\nasync_downloader = { version = \"0.1\", features = [\"egui\"] } # or \"iced\"\n```\n\nDefault features enable `egui`. Use `default-features = false` with\n`features = [\"iced\"]` for an iced-only build, or no features for the bare engine.\n\n## Core usage\n\n```rust\nuse async_downloader::{Downloader, Job, Progress, Settings, Threads};\n\nlet downloader = Downloader::new(Settings {\n    threads: Threads::Auto,\n    max_concurrent: 3,\n})?;\n\nlet download = downloader.enqueue(\n    Job::new(\"https://example.com/file.bin\", \"/tmp/file.bin\")\n        .with_sha256(\"e3b0c44298fc1c149afbf4c8996fb924...\"),\n);\n\ndownload.pause();\ndownload.resume();\ndownload.cancel();\n\nmatch download.progress() {\n    Progress::Downloading { received, total, speed } =\u003e { /* ... */ }\n    Progress::Done(outcome) =\u003e { /* outcome.verified, outcome.sha256 */ }\n    _ =\u003e {}\n}\n```\n\n## Batch / pack\n\n```rust\nuse async_downloader::Job;\n\nlet batch = downloader.enqueue_batch(vec![\n    Job::new(\"https://example.com/a.pak\", \"/data/a.pak\").with_sha256(\"...\"),\n    Job::new(\"https://example.com/b.pak\", \"/data/b.pak\").with_sha256(\"...\"),\n    Job::new(\"https://example.com/c.zip\", \"/data/c.zip\"),\n]);\n\nlet p = batch.progress(); // files, done, failed, bytes_received, bytes_total, speed\nlet _ = p.fraction();     // overall 0.0..=1.0\nlet _ = p.all_done();     // every file downloaded and verified\n\nbatch.pause_all();\nbatch.resume_all();\nbatch.cancel_all();\n\nfor download in batch.downloads() {\n    // per-file progress / controls\n}\n```\n\nFiles already present and matching their expected SHA-256 are not re-downloaded:\nthe engine issues one request, the server replies that the range is already\nsatisfied, the local file is verified, and it goes straight to done.\n\n## egui\n\n```rust\nuse async_downloader::{Downloader, Settings, Threads, egui_view};\n\nlet downloader = Downloader::new(Settings { threads: Threads::Auto, max_concurrent: 3 })?\n    .on_change(egui_view::repaint_notifier(ctx)); // repaint when progress changes\n\n// inside your update / ui callback:\negui_view::download_card(ui, \u0026download); // progress bar, speed, pause/resume/cancel\n```\n\nRun the example:\n\n```sh\ncargo run --example egui_app\n```\n\n## iced\n\n```rust\nuse async_downloader::iced_view;\n\n// in subscription():\nfn subscription(state: \u0026State) -\u003e iced::Subscription\u003cMessage\u003e {\n    iced_view::subscribe_all(\u0026state.downloads, |_id, _progress| Message::Tick)\n}\n\n// in view(), read download.progress() and wire buttons to pause/resume/cancel.\n```\n\n`subscribe_all` builds one `iced::Subscription` per download from its `watch`\nreceiver, so the UI redraws on every progress change without polling.\n\nRun the example:\n\n```sh\ncargo run --example iced_app --features iced\n```\n\n## License\n\nReleased into the public domain under the Unlicense. Do whatever you want with it.\nSee `LICENSE`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatannadev%2Fasync_downloader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatannadev%2Fasync_downloader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatannadev%2Fasync_downloader/lists"}