Download src/lib/tunnel/cloudflare/pid.js from heyeyydss/api9nin: direct link, hf CLI and curl.
- Browser
- Download file 564 Bytes
-
https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/lib/tunnel/cloudflare/pid.js
- Command line
-
hf download hf://spaces/heyeyydss/api9nin/src/lib/tunnel/cloudflare/pid.js
-
curl -L -o pid.js https://huggingface.co/spaces/heyeyydss/api9nin/resolve/main/src/lib/tunnel/cloudflare/pid.js
564 Bytes
| import fs from "fs"; | |
| import path from "path"; | |
| import { TUNNEL_DIR, ensureTunnelDir } from "../shared/state.js"; | |
| const PID_FILE = path.join(TUNNEL_DIR, "cloudflared.pid"); | |
| export function savePid(pid) { | |
| ensureTunnelDir(); | |
| fs.writeFileSync(PID_FILE, pid.toString()); | |
| } | |
| export function loadPid() { | |
| try { | |
| if (fs.existsSync(PID_FILE)) return parseInt(fs.readFileSync(PID_FILE, "utf8")); | |
| } catch { /* ignore */ } | |
| return null; | |
| } | |
| export function clearPid() { | |
| try { | |
| if (fs.existsSync(PID_FILE)) fs.unlinkSync(PID_FILE); | |
| } catch { /* ignore */ } | |
| } | |