WebAssembly (Wasm) support and limitations
mainThe hf-hub crate compiles for wasm32-unknown-unknown.
Supported Features:
- Pure-HTTP modules (
repository,spaces,users) are available. - HTTP-only methods on
HFRepository(e.g.,exists,info,list_*) are available. - Streaming downloads via
download_file_stream()are supported.
Unsupported Features (Gated behind #[cfg(not(target_family = "wasm"))]):
- Methods that touch the filesystem (
download_file,snapshot_download,upload_file). - The
cacheandbucketsmodules. - The
blockingwrappers.
Implementation Notes:
- When modifying
client,error,retry,xet, ordownload.rs, ensure the Wasm build remains green. reqwest's Wasm backend has a reduced API (nois_connect, noredirect()policy) and its streams are!Send.