Spaces:
Sleeping
Sleeping
Download tests/api-tester/puter_js/load.cjs from AZILS/puter-deploy: direct link, hf CLI and curl.
- Browser
- Download file 524 Bytes
-
https://huggingface.co/spaces/AZILS/puter-deploy/resolve/main/tests/api-tester/puter_js/load.cjs
- Command line
-
hf download hf://spaces/AZILS/puter-deploy/tests/api-tester/puter_js/load.cjs
-
curl -L -o load.cjs https://huggingface.co/spaces/AZILS/puter-deploy/resolve/main/tests/api-tester/puter_js/load.cjs
524 Bytes
| const vm = require('vm'); | |
| async function load_puterjs() { | |
| const goodContext = {} | |
| Object.getOwnPropertyNames(globalThis).forEach(name => { try { goodContext[name] = globalThis[name]; } catch { } }) | |
| goodContext.globalThis = goodContext | |
| const code = await fetch("http://puter.localhost:4100/puter.js/v2").then(res => res.text()); | |
| const context = vm.createContext(goodContext); | |
| const result = vm.runInNewContext(code, context); | |
| return goodContext.puter; | |
| } | |
| module.exports = load_puterjs; |