pito-fetch

Downloads you can trust, in one call. pito-fetch is a small Rust library, part of PITO MD: give it a URL, where the file goes and the file’s sha256. It downloads into a .part file, picks that file up again after a crash or a dropped connection, checks the sha256 and only then renames it into place. A file is there whole and verified, or not at all.
| 1 GiB downloaded and verified | 2.47 s on loopback, in 7.8 MiB of memory |
| Library code | 699 lines of Rust |
| Dependencies | 3 direct (ureq, sha2, thiserror), no OpenSSL or other system library |
| Clean release build | 11.7 s |
| A downloader built on it | 2.5 MB stripped, TLS and root certificates included |
Speed and memory says how each number was measured. Works on Linux and macOS (Windows through WSL).
Start here
Section titled “Start here”- Install: add the crate and download your first file.
- Download a file: a
Request, aFetcherand a progress callback. - Resume and verify: what happens after a crash, a Ctrl-C or a wrong sha256.
- Cancel a download: stop it from another thread and resume it later.
- Handle errors: every
FetchError, and what to do with each. - Two downloads of one file: threads or processes racing for the same file.
- Timeouts and limits: containment, timings, retries, redirects and byte caps.
- Write the sha256 sums: make the sums a manifest pins, and a static manifest with
FetchSpec. - Try it locally: the
getandserveexamples. - Formats: the part file, the sha256 strings and the progress values it promises.
- API reference: every public type and function, from
cargo doc. - Changelog.
Licence
Section titled “Licence”The code is MIT licensed, © Catalin Ilinca. The pito-fetch and PITO MD names and their logos are © Catalin Ilinca, all rights reserved, and are not covered by the MIT licence. Source and issues: github.com/gmrdad82/pito-fetch.