tpt_hf_hub/lib.rs
1//! Async Hugging Face Hub downloader and cache manager.
2//!
3//! [`HubClient`] downloads files from a Hugging Face Hub compatible server
4//! into an XDG-style local cache (`~/.cache/tpt/hub` by default), with:
5//!
6//! - Resumable downloads via HTTP `Range` requests
7//! - SHA256 verification against the Hub's linked ETag, when available
8//! - Atomic writes (download to `*.tmp`, rename on success)
9//! - A [`ProgressReporter`] trait so callers can plug in their own UI
10//!
11//! ```no_run
12//! use tpt_hf_hub::{HubClient, NoopProgressReporter};
13//!
14//! # async fn run() -> Result<(), Box<dyn std::error::Error>> {
15//! let client = HubClient::new()?;
16//! let path = client
17//! .download_file("gpt2", "config.json", &NoopProgressReporter)
18//! .await?;
19//! println!("downloaded to {}", path.display());
20//! # Ok(())
21//! # }
22//! ```
23
24#![warn(missing_docs)]
25
26mod cache;
27mod client;
28mod error;
29mod progress;
30
31pub use cache::default_cache_dir;
32pub use client::HubClient;
33pub use error::HubError;
34pub use progress::{NoopProgressReporter, ProgressReporter};