Skip to main content

hf

7 configuration options · available in Rust, Python, Node.js, Java

Quick start
use opendal::Operator;

let op = Operator::via_iter("hf", [
])?;
All configuration options (copy & trim)
Full reference
use opendal::Operator;

let op = 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.
//
// Default is "https://huggingface.co".
// ("endpoint".to_string(), "...".to_string()),

// Download mode. Either `xet` (default) or `http`.
// ("download_mode".to_string(), "...".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.

Configuration reference

General7
KeyTypeRequiredDescription
repo_typestringnoRepo type of this backend. Required.
repo_idstringnoRepo id of this backend. This is required.
revisionstringnoRevision of this backend. Default is main.
rootstringnoRoot of this backend. Can be "/path/to/dir". Default is "/".
tokenstringnoToken of this backend. This is optional.
endpointstringnoEndpoint of the Hugging Face Hub. Default is "https://huggingface.co".
download_modestringnoDownload mode. Either xet (default) or http.