Download packages/kap-server/src/version.ts from SaylorTwift/kimi-code: direct link, hf CLI and curl.
- Browser
- Download file 523 Bytes
-
https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/kap-server/src/version.ts
- Command line
-
hf download hf://SaylorTwift/kimi-code/packages/kap-server/src/version.ts
-
curl -L -o version.ts https://huggingface.co/SaylorTwift/kimi-code/resolve/main/packages/kap-server/src/version.ts
523 Bytes
| import { readFileSync } from 'node:fs'; | |
| import { fileURLToPath } from 'node:url'; | |
| let cached: string | undefined; | |
| export function getServerVersion(): string { | |
| if (cached !== undefined) return cached; | |
| try { | |
| const pkgUrl = new URL('../package.json', import.meta.url); | |
| const raw = readFileSync(fileURLToPath(pkgUrl), 'utf-8'); | |
| const pkg = JSON.parse(raw) as { version?: unknown }; | |
| cached = typeof pkg.version === 'string' ? pkg.version : '0.0.0'; | |
| } catch { | |
| cached = '0.0.0'; | |
| } | |
| return cached; | |
| } | |