Spaces:
Paused
Paused
Download utils/sudoStore.js from Mega-Evolutions/empty: direct link, hf CLI and curl.
- Browser
- Download file 611 Bytes
-
https://huggingface.co/spaces/Mega-Evolutions/empty/resolve/main/utils/sudoStore.js
- Command line
-
hf download hf://spaces/Mega-Evolutions/empty/utils/sudoStore.js
-
curl -L -o sudoStore.js https://huggingface.co/spaces/Mega-Evolutions/empty/resolve/main/utils/sudoStore.js
611 Bytes
| import fs from 'fs' | |
| import path from 'path' | |
| const filePath = path.join(process.cwd(), 'data', 'sudo.json') | |
| function ensureFile() { | |
| const dir = path.dirname(filePath) | |
| if (!fs.existsSync(dir)) fs.mkdirSync(dir, { recursive: true }) | |
| if (!fs.existsSync(filePath)) fs.writeFileSync(filePath, JSON.stringify([])) | |
| } | |
| export function loadSudoList() { | |
| ensureFile() | |
| try { | |
| const data = fs.readFileSync(filePath, 'utf-8') | |
| return new Set(JSON.parse(data)) | |
| } catch { | |
| return new Set() | |
| } | |
| } | |
| export function saveSudoList(set) { | |
| ensureFile() | |
| fs.writeFileSync(filePath, JSON.stringify([...set])) | |
| } | |