8 configuration options · available in Rust, Java, Python, Node.js, Go
use opendal::Operator;
let operator = Operator::via_iter("hf", [
])?;
use opendal::Operator;
let operator = Operator::via_iter("hf", [
// Repo type of this backend. Required.
// ("repo_type".to_string(), "...".to_string()),
// Repo id of this backend.
//
// This is required.
// ("repo_id".to_string(), "...".to_string()),
// Revision of this backend.
//
// Default is main.
// ("revision".to_string(), "...".to_string()),
// Root of this backend. Can be "/path/to/dir".
//
// Default is "/".
// ("root".to_string(), "...".to_string()),
// Token of this backend.
//
// This is optional.
// ("token".to_string(), "...".to_string()),
// Endpoint of the Hugging Face Hub.
//
// The default is `https://huggingface.co`.
// ("endpoint".to_string(), "...".to_string()),
// Download mode. Either `xet` (default) or `http`.
//
// When unset, the mode is resolved from the `HF_HUB_DISABLE_XET`
// environment variable: a non-empty value forces `http`, otherwise it
// defaults to `xet`. An explicit value here takes precedence.
//
// See <https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisablexet>.
// ("download_mode".to_string(), "...".to_string()),
// Enable caching of resolved HTTP download addresses and XET file metadata.
//
// Defaults to `false`. Set to `true` to share resolve results across readers
// on the same backend. Changed files may remain invisible while cached
// results are reused. A reader retains XET metadata from its first read for
// its lifetime. Create a new reader to resolve the path again when this
// option is disabled.
// See [`HfBuilder::enable_resolve_cache`] for freshness semantics.
// ("enable_resolve_cache".to_string(), "true".to_string()),
])?;
Every option is passed as a string key; OpenDAL parses it into the right type. Some services may require building the binding with the matching services-* feature enabled.
| Key | Type | Required | Description |
|---|---|---|---|
repo_type | string | no | Repo type of this backend. Required. |
repo_id | string | no | Repo id of this backend. This is required. |
revision | string | no | Revision of this backend. Default is main. |
root | string | no | Root of this backend. Can be "/path/to/dir". Default is "/". |
token | string | no | Token of this backend. This is optional. |
endpoint | string | no | Endpoint of the Hugging Face Hub.
The default is https://huggingface.co. |
download_mode | string | no | Download mode. Either xet (default) or http.
When unset, the mode is resolved from the HF_HUB_DISABLE_XET
environment variable: a non-empty value forces http, otherwise it
defaults to xet. An explicit value here takes precedence.
See <https://huggingface.co/docs/huggingface_hub/package_reference/environment_variables#hfhubdisablexet>. |
enable_resolve_cache | bool | no | Enable caching of resolved HTTP download addresses and XET file metadata.
Defaults to false. Set to true to share resolve results across readers
on the same backend. Changed files may remain invisible while cached
results are reused. A reader retains XET metadata from its first read for
its lifetime. Create a new reader to resolve the path again when this
option is disabled.
See [HfBuilder::enable_resolve_cache] for freshness semantics. |