Spaces:
Paused
Paused
Download node_modules/@huggingface/hub/src/utils/parseLinkHeader.ts from Leon4gr45/nova-header-nav: direct link, hf CLI and curl.
- Browser
- Download file 364 Bytes
-
https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40huggingface/hub/src/utils/parseLinkHeader.ts
- Command line
-
hf download hf://spaces/Leon4gr45/nova-header-nav/node_modules/@huggingface/hub/src/utils/parseLinkHeader.ts
-
curl -L -o parseLinkHeader.ts https://huggingface.co/spaces/Leon4gr45/nova-header-nav/resolve/main/node_modules/%40huggingface/hub/src/utils/parseLinkHeader.ts
364 Bytes
| /** | |
| * Parse Link HTTP header, eg `<https://huggingface.co/api/datasets/bigscience/P3/tree/main?recursive=1&cursor=...>; rel="next"` | |
| */ | |
| export function parseLinkHeader(header: string): Record<string, string> { | |
| const regex = /<(https?:[/][/][^>]+)>;\s+rel="([^"]+)"/g; | |
| return Object.fromEntries([...header.matchAll(regex)].map(([, url, rel]) => [rel, url])); | |
| } | |