Ƭ AccessToken: string
Actually hf_${string}
, but for convenience, using the string type
Ƭ AccessTokenRole: "admin"
| "write"
| "contributor"
| "read"
Ƭ AuthType: "access_token"
| "app_token"
| "app_token_as_user"
Ƭ CommitOperation: CommitDeletedEntry
| CommitFile
Ƭ CommitParams: { abortSignal?
: AbortSignal
; branch?
: string
; description?
: string
; fetch?
: typeof fetch
; hubUrl?
: string
; isPullRequest?
: boolean
; operations
: CommitOperation
[] ; parentCommit?
: string
; repo
: RepoDesignation
; title
: string
; useWebWorkers?
: boolean
| { minSize?
: number
; poolSize?
: number
} } & Partial
\<CredentialsParams
>
Ƭ CommitProgressEvent: { event
: "phase"
; phase
: "preuploading"
| "uploadingLargeFiles"
| "committing"
} | { event
: "fileProgress"
; path
: string
; progress
: number
; state
: "hashing"
| "uploading"
}
Ƭ ContentSource: Blob
| URL
Ƭ Dtype: "F64"
| "F32"
| "F16"
| "BF16"
| "I64"
| "I32"
| "I16"
| "I8"
| "U8"
| "BOOL"
hub/src/lib/parse-safetensors-metadata.ts:45
Ƭ PipelineType: keyof typeof PIPELINE_DATA
tasks/dist/commonjs/pipelines.d.ts:426
Ƭ RepoDesignation: RepoId
| RepoFullName
Ƭ RepoFullName: string
| `spaces/${string}` | `datasets/${string}`
Ƭ RepoType: "space"
| "dataset"
| "model"
Ƭ SafetensorsFileHeader: Record
\<TensorName
, TensorInfo
> & { __metadata__
: Record
\<string
, string
> }
hub/src/lib/parse-safetensors-metadata.ts:53
Ƭ SafetensorsParseFromRepo: { header
: SafetensorsFileHeader
; parameterCount?
: Partial
\<Record
\<Dtype
, number
>> ; sharded
: false
} | { headers
: SafetensorsShardedHeaders
; index
: SafetensorsIndexJson
; parameterCount?
: Partial
\<Record
\<Dtype
, number
>> ; sharded
: true
}
hub/src/lib/parse-safetensors-metadata.ts:67
Ƭ SafetensorsShardedHeaders: Record
\<FileName
, SafetensorsFileHeader
>
hub/src/lib/parse-safetensors-metadata.ts:65
Ƭ SpaceHardwareFlavor: "cpu-basic"
| "cpu-upgrade"
| "t4-small"
| "t4-medium"
| "l4x1"
| "l4x4"
| "a10g-small"
| "a10g-large"
| "a10g-largex2"
| "a10g-largex4"
| "a100-large"
| "v5e-1x1"
| "v5e-2x2"
| "v5e-2x4"
Ƭ SpaceSdk: "streamlit"
| "gradio"
| "docker"
| "static"
Ƭ SpaceStage: "NO_APP_FILE"
| "CONFIG_ERROR"
| "BUILDING"
| "BUILD_ERROR"
| "RUNNING"
| "RUNNING_BUILDING"
| "RUNTIME_ERROR"
| "DELETING"
| "PAUSED"
| "SLEEPING"
Ƭ TensorName: string
hub/src/lib/parse-safetensors-metadata.ts:44
Ƭ WhoAmI: WhoAmIApp
| WhoAmIOrg
| WhoAmIUser
• Const
DATASET_EXPANDABLE_KEYS: readonly ["author"
, "cardData"
, "citation"
, "createdAt"
, "disabled"
, "description"
, "downloads"
, "downloadsAllTime"
, "gated"
, "gitalyUid"
, "lastModified"
, "likes"
, "paperswithcode_id"
, "private"
, "sha"
, "tags"
]
hub/src/lib/list-datasets.ts:17
• Const
DATASET_EXPAND_KEYS: readonly ["private"
, "downloads"
, "gated"
, "likes"
, "lastModified"
]
hub/src/lib/list-datasets.ts:9
• Const
DEFAULT_REVISION: "main"
hub/src/lib/snapshot-download.ts:12
• Const
MODEL_EXPANDABLE_KEYS: readonly ["author"
, "cardData"
, "config"
, "createdAt"
, "disabled"
, "downloads"
, "downloadsAllTime"
, "gated"
, "gitalyUid"
, "lastModified"
, "library_name"
, "likes"
, "model-index"
, "pipeline_tag"
, "private"
, "safetensors"
, "sha"
, "spaces"
, "tags"
, "transformersInfo"
]
• Const
MODEL_EXPAND_KEYS: readonly ["pipeline_tag"
, "private"
, "gated"
, "downloads"
, "likes"
, "lastModified"
]
• Const
REGEX_COMMIT_HASH: RegExp
hub/src/lib/download-file-to-cache-dir.ts:10
• Const
REPO_ID_SEPARATOR: string
= "--"
hub/src/lib/cache-management.ts:25
• Const
RE_SAFETENSORS_FILE: RegExp
hub/src/lib/parse-safetensors-metadata.ts:14
• Const
RE_SAFETENSORS_INDEX_FILE: RegExp
hub/src/lib/parse-safetensors-metadata.ts:15
• Const
RE_SAFETENSORS_SHARD_FILE: RegExp
hub/src/lib/parse-safetensors-metadata.ts:16
• Const
SAFETENSORS_FILE: "model.safetensors"
hub/src/lib/parse-safetensors-metadata.ts:10
• Const
SAFETENSORS_INDEX_FILE: "model.safetensors.index.json"
hub/src/lib/parse-safetensors-metadata.ts:11
• Const
SPACE_EXPANDABLE_KEYS: readonly ["author"
, "cardData"
, "datasets"
, "disabled"
, "gitalyUid"
, "lastModified"
, "createdAt"
, "likes"
, "private"
, "runtime"
, "sdk"
, "sha"
, "subdomain"
, "tags"
, "models"
]
• Const
SPACE_EXPAND_KEYS: readonly ["sdk"
, "likes"
, "private"
, "lastModified"
]
▸ __internal_sha256(buffer
, opts?
): AsyncGenerator
\<number
, string
>
Name | Type |
---|---|
buffer | Blob |
opts? | Object |
opts.abortSignal? | AbortSignal |
opts.useWebWorker? | boolean | { minSize? : number ; poolSize? : number } |
AsyncGenerator
\<number
, string
>
hex-encoded sha
Yields
progress (0-1)
▸ checkRepoAccess(params
): Promise
\<void
>
Check if we have read access to a repository.
Throw a HubApiError error if we don’t have access. HubApiError.statusCode will be 401, 403 or 404.
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; repo : RepoDesignation } & Partial \<CredentialsParams > |
Promise
\<void
>
hub/src/lib/check-repo-access.ts:13
▸ commit(params
): Promise
\<CommitOutput
>
Name | Type |
---|---|
params | CommitParams |
Promise
\<CommitOutput
>
▸ commitIter(params
): AsyncGenerator
\<CommitProgressEvent
, CommitOutput
>
Internal function for now, used by commit.
Can be exposed later to offer fine-tuned progress info
Name | Type |
---|---|
params | CommitParams |
AsyncGenerator
\<CommitProgressEvent
, CommitOutput
>
▸ countCommits(params
): Promise
\<number
>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<number
>
hub/src/lib/count-commits.ts:7
▸ createRepo(params
): Promise
\<{ repoUrl
: string
}>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; files? : { content : ArrayBuffer | Blob ; path : string }[] ; hubUrl? : string ; license? : string ; private? : boolean ; repo : RepoDesignation ; sdk? : SpaceSdk | undefined } & CredentialsParams |
Promise
\<{ repoUrl
: string
}>
▸ datasetInfo\<T
>(params
): Promise
\<DatasetEntry
& Pick
\<ApiDatasetInfo
, T
>>
Name | Type |
---|---|
T | extends "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "paperswithcode_id" | "sha" | "citation" | "description" | "downloadsAllTime" = never |
Name | Type |
---|---|
params | { additionalFields? : T [] ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; name : string ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<DatasetEntry
& Pick
\<ApiDatasetInfo
, T
>>
▸ deleteFile(params
): Promise
\<CommitOutput
>
Name | Type |
---|---|
params | { branch? : string ; commitDescription? : string ; commitTitle? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; isPullRequest? : boolean ; parentCommit? : string ; path : string ; repo : RepoDesignation } & CredentialsParams |
Promise
\<CommitOutput
>
▸ deleteFiles(params
): Promise
\<CommitOutput
>
Name | Type |
---|---|
params | { branch? : string ; commitDescription? : string ; commitTitle? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; isPullRequest? : boolean ; parentCommit? : string ; paths : string [] ; repo : RepoDesignation } & CredentialsParams |
Promise
\<CommitOutput
>
▸ deleteRepo(params
): Promise
\<void
>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; repo : RepoDesignation } & CredentialsParams |
Promise
\<void
>
▸ downloadFile(params
): Promise
\<Response
| null
>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path : string ; range? : [number , number ] ; raw? : boolean ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<Response
| null
>
null when the file doesn’t exist
hub/src/lib/download-file.ts:10
▸ downloadFileToCacheDir(params
): Promise
\<string
>
Download a given file if it’s not already present in the local cache.
Name | Type |
---|---|
params | { cacheDir? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path : string ; raw? : boolean ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<string
>
the symlink to the blob object
hub/src/lib/download-file-to-cache-dir.ts:40
▸ fileDownloadInfo(params
): Promise
\<FileDownloadInfoOutput
| null
>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; noContentDisposition? : boolean ; path : string ; raw? : boolean ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<FileDownloadInfoOutput
| null
>
null when the file doesn’t exist
hub/src/lib/file-download-info.ts:18
▸ fileExists(params
): Promise
\<boolean
>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<boolean
>
▸ getBlobStat(blobPath
, blobStats
): Promise
\<Stats
>
Name | Type |
---|---|
blobPath | string |
blobStats | Map \<string , Stats > |
Promise
\<Stats
>
hub/src/lib/cache-management.ts:244
▸ getHFHubCachePath(): string
string
hub/src/lib/cache-management.ts:19
▸ getRepoFolderName(«destructured»
): string
Name | Type |
---|---|
«destructured» | RepoId |
string
hub/src/lib/cache-management.ts:27
▸ listCommits(params
): AsyncGenerator
\<CommitData
>
Name | Type |
---|---|
params | { batchSize? : number ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
AsyncGenerator
\<CommitData
>
hub/src/lib/list-commits.ts:17
▸ listDatasets\<T
>(params?
): AsyncGenerator
\<DatasetEntry
& Pick
\<ApiDatasetInfo
, T
>>
Name | Type |
---|---|
T | extends "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "paperswithcode_id" | "sha" | "citation" | "description" | "downloadsAllTime" = never |
Name | Type |
---|---|
params? | { search?: { query?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; } | undefined; hubUrl?: string | undefined; additionalFields?: T[] | undefined; limit?: number | undefined; fetch?: { …; } | undefined; } & Partial\<…> |
AsyncGenerator
\<DatasetEntry
& Pick
\<ApiDatasetInfo
, T
>>
hub/src/lib/list-datasets.ts:47
▸ listFiles(params
): AsyncGenerator
\<ListFileEntry
>
List files in a folder. To list ALL files in the directory, call it
with params.recursive set to true
.
Name | Type |
---|---|
params | { expand? : boolean ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path? : string ; recursive? : boolean ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
AsyncGenerator
\<ListFileEntry
>
▸ listModels\<T
>(params?
): AsyncGenerator
\<ModelEntry
& Pick
\<ApiModelInfo
, T
>>
Name | Type |
---|---|
T | extends "spaces" | "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "sha" | "downloadsAllTime" | "config" | "library_name" | "model-index" | "safetensors" | "transformersInfo" = never |
Name | Type |
---|---|
params? | { search?: { query?: string | undefined; owner?: string | undefined; task?: “other” | “text-classification” | “token-classification” | “table-question-answering” | “question-answering” | … 48 more … | undefined; tags?: string[] | undefined; } | undefined; hubUrl?: string | undefined; additionalFields?: T[] | und… |
AsyncGenerator
\<ModelEntry
& Pick
\<ApiModelInfo
, T
>>
▸ listSpaces\<T
>(params?
): AsyncGenerator
\<SpaceEntry
& Pick
\<ApiSpaceInfo
, T
>>
Name | Type |
---|---|
T | extends "models" | "datasets" | "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "sha" | "subdomain" | "runtime" = never |
Name | Type |
---|---|
params? | { search?: { query?: string | undefined; owner?: string | undefined; tags?: string[] | undefined; } | undefined; hubUrl?: string | undefined; fetch?: { (input: URL | RequestInfo, init?: RequestInit | undefined): Promise\<…>; (input: string | … 1 more … | Request, init?: RequestInit | undefined): Promise\<…>; }… |
AsyncGenerator
\<SpaceEntry
& Pick
\<ApiSpaceInfo
, T
>>
▸ modelInfo\<T
>(params
): Promise
\<ModelEntry
& Pick
\<ApiModelInfo
, T
>>
Name | Type |
---|---|
T | extends "spaces" | "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "sha" | "downloadsAllTime" | "config" | "library_name" | "model-index" | "safetensors" | "transformersInfo" = never |
Name | Type |
---|---|
params | { additionalFields? : T [] ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; name : string ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<ModelEntry
& Pick
\<ApiModelInfo
, T
>>
▸ oauthHandleRedirect(opts?
): Promise
\<OAuthResult
>
To call after the OAuth provider redirects back to the app.
There is also a helper function oauthHandleRedirectIfPresent, which will call oauthHandleRedirect
if the URL contains an oauth code
in the query parameters and return false
otherwise.
Name | Type | Description |
---|---|---|
opts? | Object | - |
opts.codeVerifier? | string | codeVerifier generated by oauthLoginUrl Default ts localStorage.getItem("huggingface.co:oauth:code_verifier") |
opts.hubUrl? | string | The URL of the hub. Defaults to HUB_URL. |
opts.nonce? | string | nonce generated by oauthLoginUrl Default ts localStorage.getItem("huggingface.co:oauth:nonce") |
opts.redirectedUrl? | string | The URL to analyze. Default ts window.location.href |
Promise
\<OAuthResult
>
hub/src/lib/oauth-handle-redirect.ts:114
▸ oauthHandleRedirectIfPresent(opts?
): Promise
\<OAuthResult
| false
>
To call after the OAuth provider redirects back to the app.
It returns false if the URL does not contain an oauth code in the query parameters, otherwise it calls oauthHandleRedirect.
Depending on your app, you may want to call oauthHandleRedirect directly instead.
Name | Type | Description |
---|---|---|
opts? | Object | - |
opts.codeVerifier? | string | codeVerifier generated by oauthLoginUrl Default ts localStorage.getItem("huggingface.co:oauth:code_verifier") |
opts.hubUrl? | string | The URL of the hub. Defaults to HUB_URL. |
opts.nonce? | string | nonce generated by oauthLoginUrl Default ts localStorage.getItem("huggingface.co:oauth:nonce") |
opts.redirectedUrl? | string | The URL to analyze. Default ts window.location.href |
Promise
\<OAuthResult
| false
>
hub/src/lib/oauth-handle-redirect.ts:284
▸ oauthLoginUrl(opts?
): Promise
\<string
>
Use “Sign in with Hub” to authenticate a user, and get oauth user info / access token.
Returns an url to redirect to. After the user is redirected back to your app, call oauthHandleRedirect
to get the oauth user info / access token.
When called from inside a static Space with OAuth enabled, it will load the config from the space, otherwise you need to at least specify the client ID of your OAuth App.
Name | Type | Description |
---|---|---|
opts? | Object | - |
opts.clientId? | string | OAuth client ID. For static Spaces, you can omit this and it will be loaded from the Space config, as long as hf_oauth: true is present in the README.md’s metadata. For other Spaces, it is available to the backend in the OAUTH_CLIENT_ID environment variable, as long as hf_oauth: true is present in the README.md’s metadata. You can also create a Developer Application at https://huggingface.co/settings/connected-applications and use its client ID. |
opts.hubUrl? | string | - |
opts.localStorage? | Object | If provided, will be filled with the code verifier and nonce used for the OAuth flow, instead of using localStorage. When calling oauthHandleRedirectIfPresent or oauthHandleRedirect you will need to provide the same values. |
opts.localStorage.codeVerifier? | string | - |
opts.localStorage.nonce? | string | - |
opts.redirectUrl? | string | Redirect URI, defaults to the current URL. For Spaces, any URL within the Space is allowed. For Developer Applications, you can add any URL you want to the list of allowed redirect URIs at https://huggingface.co/settings/connected-applications. |
opts.scopes? | string | OAuth scope, a list of space-separated scopes. For static Spaces, you can omit this and it will be loaded from the Space config, as long as hf_oauth: true is present in the README.md’s metadata. For other Spaces, it is available to the backend in the OAUTH_SCOPES environment variable, as long as hf_oauth: true is present in the README.md’s metadata. Defaults to “openid profile”. You can also create a Developer Application at https://huggingface.co/settings/connected-applications and use its scopes. See https://huggingface.co/docs/hub/oauth for a list of available scopes. |
opts.state? | string | State to pass to the OAuth provider, which will be returned in the call to oauthLogin after the redirect. |
Promise
\<string
>
Example
import { oauthLoginUrl, oauthHandleRedirectIfPresent } from "@huggingface/hub";
const oauthResult = await oauthHandleRedirectIfPresent();
if (!oauthResult) {
// If the user is not logged in, redirect to the login page
window.location.href = await oauthLoginUrl();
}
// You can use oauthResult.accessToken, oauthResult.accessTokenExpiresAt and oauthResult.userInfo
console.log(oauthResult);
(Theoretically, this function could be used to authenticate a user for any OAuth provider supporting PKCE and OpenID Connect by changing hubUrl
,
but it is currently only tested with the Hugging Face Hub.)
hub/src/lib/oauth-login-url.ts:31
▸ parseRepoType(type
): RepoType
Name | Type |
---|---|
type | string |
hub/src/lib/cache-management.ts:254
▸ parseSafetensorsMetadata(params
): Promise
\<SetRequired
\<SafetensorsParseFromRepo
, "parameterCount"
>>
Analyze model.safetensors.index.json or model.safetensors from a model hosted on Hugging Face using smart range requests to extract its metadata.
Name | Type |
---|---|
params | { computeParametersCount : true ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path? : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<SetRequired
\<SafetensorsParseFromRepo
, "parameterCount"
>>
hub/src/lib/parse-safetensors-metadata.ts:177
▸ parseSafetensorsMetadata(params
): Promise
\<SafetensorsParseFromRepo
>
Name | Type |
---|---|
params | { computeParametersCount? : boolean ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; path? : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<SafetensorsParseFromRepo
>
hub/src/lib/parse-safetensors-metadata.ts:199
▸ parseSafetensorsShardFilename(filename
): SafetensorsShardFileInfo
| null
Name | Type |
---|---|
filename | string |
SafetensorsShardFileInfo
| null
hub/src/lib/parse-safetensors-metadata.ts:24
▸ pathsInfo(params
): Promise
\<PathInfo
& { lastCommit
: CommitInfo
; securityFileStatus
: SecurityFileStatus
}[]>
Name | Type |
---|---|
params | { expand : true ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; paths : string [] ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<PathInfo
& { lastCommit
: CommitInfo
; securityFileStatus
: SecurityFileStatus
}[]>
▸ pathsInfo(params
): Promise
\<PathInfo
[]>
Name | Type |
---|---|
params | { expand? : boolean ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; paths : string [] ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<PathInfo
[]>
▸ scanCacheDir(cacheDir?
): Promise
\<HFCacheInfo
>
Name | Type | Default value |
---|---|---|
cacheDir | undefined | string | undefined |
Promise
\<HFCacheInfo
>
hub/src/lib/cache-management.ts:72
▸ scanCachedRepo(repoPath
): Promise
\<CachedRepoInfo
>
Name | Type |
---|---|
repoPath | string |
Promise
\<CachedRepoInfo
>
hub/src/lib/cache-management.ts:114
▸ scanRefsDir(refsPath
, refsByHash
): Promise
\<void
>
Name | Type |
---|---|
refsPath | string |
refsByHash | Map \<string , string []> |
Promise
\<void
>
hub/src/lib/cache-management.ts:204
▸ scanSnapshotDir(revisionPath
, cachedFiles
, blobStats
): Promise
\<void
>
Name | Type |
---|---|
revisionPath | string |
cachedFiles | CachedFileInfo [] |
blobStats | Map \<string , Stats > |
Promise
\<void
>
hub/src/lib/cache-management.ts:219
▸ snapshotDownload(params
): Promise
\<string
>
Downloads an entire repository at a given revision in the cache directory getHFHubCachePath. You can list all cached repositories using scanCachedRepo
Name | Type |
---|---|
params | { cacheDir? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; repo : RepoDesignation ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<string
>
Remarks
It uses internally downloadFileToCacheDir.
hub/src/lib/snapshot-download.ts:19
▸ spaceInfo\<T
>(params
): Promise
\<SpaceEntry
& Pick
\<ApiSpaceInfo
, T
>>
Name | Type |
---|---|
T | extends "models" | "datasets" | "author" | "cardData" | "disabled" | "gitalyUid" | "createdAt" | "tags" | "sha" | "subdomain" | "runtime" = never |
Name | Type |
---|---|
params | { additionalFields? : T [] ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string ; name : string ; revision? : string } & Partial \<CredentialsParams > |
Promise
\<SpaceEntry
& Pick
\<ApiSpaceInfo
, T
>>
▸ uploadFile(params
): Promise
\<CommitOutput
>
Name | Type |
---|---|
params | { abortSignal? : AbortSignal ; branch? : string ; commitDescription? : string ; commitTitle? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; file : URL | File | { content : ContentSource ; path : string } ; hubUrl? : string ; isPullRequest? : boolean ; parentCommit? : string ; repo : RepoDesignation ; useWebWorkers? : boolean | { minSize? : number ; poolSize? : number } } & Partial \<CredentialsParams > |
Promise
\<CommitOutput
>
▸ uploadFiles(params
): Promise
\<CommitOutput
>
Name | Type |
---|---|
params | { abortSignal? : AbortSignal ; branch? : string ; commitDescription? : string ; commitTitle? : string ; fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; files : (URL | File | { content : ContentSource ; path : string })[] ; hubUrl? : string ; isPullRequest? : boolean ; parentCommit? : string ; repo : RepoDesignation ; useWebWorkers? : boolean | { minSize? : number ; poolSize? : number } } & Partial \<CredentialsParams > |
Promise
\<CommitOutput
>
▸ uploadFilesWithProgress(params
): AsyncGenerator
\<CommitProgressEvent
, CommitOutput
>
Uploads with progress
Needs XMLHttpRequest to be available for progress events for uploads Set useWebWorkers to true in order to have progress events for hashing
Name | Type |
---|---|
params | { abortSignal? : AbortSignal ; branch? : string ; commitDescription? : string ; commitTitle? : string ; files : (URL | File | { content : ContentSource ; path : string })[] ; hubUrl? : string ; isPullRequest? : boolean ; parentCommit? : string ; repo : RepoDesignation ; useWebWorkers? : boolean | { minSize? : number ; poolSize? : number } } & Partial \<CredentialsParams > |
AsyncGenerator
\<CommitProgressEvent
, CommitOutput
>
hub/src/lib/upload-files-with-progress.ts:20
▸ whoAmI(params
): Promise
\<WhoAmI
& { auth
: AuthInfo
}>
Name | Type |
---|---|
params | { fetch? : (input : URL | RequestInfo, init? : RequestInit ) => Promise \<Response >(input : string | URL | Request , init? : RequestInit ) => Promise \<Response > ; hubUrl? : string } & CredentialsParams |
Promise
\<WhoAmI
& { auth
: AuthInfo
}>