Spaces:
Sleeping
Sleeping
Download apps/api/src/lib/parseApi.ts from s-eto-hub/firecrawl-api: direct link, hf CLI and curl.
- Browser
- Download file 607 Bytes
-
https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/api/src/lib/parseApi.ts
- Command line
-
hf download hf://spaces/s-eto-hub/firecrawl-api/apps/api/src/lib/parseApi.ts
-
curl -L -o parseApi.ts https://huggingface.co/spaces/s-eto-hub/firecrawl-api/resolve/main/apps/api/src/lib/parseApi.ts
607 Bytes
| export function parseApi(api: string) { | |
| // Handle older versions of the API that don't have the fc- prefix | |
| if (!api.startsWith("fc-")) { | |
| return api; | |
| } | |
| // remove the fc- prefix | |
| // re add all the dashes based on the uuidv4 format | |
| // 3d478a29-6e59-403e-85c7-94aba81ffd2a | |
| const uuid = api | |
| .replace(/^fc-/, "") | |
| .replace(/(.{8})(.{4})(.{4})(.{4})(.{12})/, "$1-$2-$3-$4-$5"); | |
| return uuid; | |
| } | |
| function apiKeyToFcApiKey(apiKey: string | null | undefined) { | |
| if (!apiKey) { | |
| return null; | |
| } | |
| const uuidWithoutDashes = apiKey.replace(/-/g, ""); | |
| return `fc-${uuidWithoutDashes}`; | |
| } | |