Spaces:
Paused
Paused
Download node_modules/@huggingface/hub/src/utils/checkCredentials.ts from Leon4gr45/nova-header-nav: direct link, hf CLI and curl.
- Browser
- Download file 560 Bytes
-
https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40huggingface/hub/src/utils/checkCredentials.ts
- Command line
-
hf download hf://spaces/Leon4gr45/nova-header-nav/node_modules/@huggingface/hub/src/utils/checkCredentials.ts
-
curl -L -o checkCredentials.ts https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40huggingface/hub/src/utils/checkCredentials.ts
560 Bytes
| import type { CredentialsParams } from "../types/public"; | |
| export function checkAccessToken(accessToken: string): void { | |
| if (!accessToken.startsWith("hf_")) { | |
| throw new TypeError("Your access token must start with 'hf_'"); | |
| } | |
| } | |
| export function checkCredentials(params: Partial<CredentialsParams>): string | undefined { | |
| if (params.accessToken) { | |
| checkAccessToken(params.accessToken); | |
| return params.accessToken; | |
| } | |
| if (params.credentials?.accessToken) { | |
| checkAccessToken(params.credentials.accessToken); | |
| return params.credentials.accessToken; | |
| } | |
| } | |