Download src/lib/tools.js from ainz/hi: direct link, hf CLI and curl.
- Browser
- Download file 332 Bytes
-
https://huggingface.co/spaces/ainz/hi/resolve/main/src/lib/tools.js
- Command line
-
hf download hf://spaces/ainz/hi/src/lib/tools.js
-
curl -L -o tools.js https://huggingface.co/spaces/ainz/hi/resolve/main/src/lib/tools.js
332 Bytes
| const crypto = require('crypto') | |
| const uuid = () => { | |
| return crypto.randomUUID() | |
| } | |
| const isJson = (str) => { | |
| try { | |
| JSON.parse(str) | |
| return true | |
| } catch (error) { | |
| return false | |
| } | |
| } | |
| const sleep = async (ms) => { | |
| return new Promise(resolve => setTimeout(resolve, ms)) | |
| } | |
| module.exports = { uuid, isJson, sleep } | |