Spaces:
Runtime error
Runtime error
Download src/lib/isomorphic/node.ts from Dragoning/bingo-going: direct link, hf CLI and curl.
- Browser
- Download file 727 Bytes
-
https://huggingface.co/spaces/Dragoning/bingo-going/resolve/main/src/lib/isomorphic/node.ts
- Command line
-
hf download hf://spaces/Dragoning/bingo-going/src/lib/isomorphic/node.ts
-
curl -L -o node.ts https://huggingface.co/spaces/Dragoning/bingo-going/resolve/main/src/lib/isomorphic/node.ts
727 Bytes
| import Debug from 'debug' | |
| const { fetch, setGlobalDispatcher, ProxyAgent } = require('undici') | |
| const { HttpsProxyAgent } = require('https-proxy-agent') | |
| const ws = require('ws') | |
| const debug = Debug('bingo') | |
| const httpProxy = process.env.http_proxy || process.env.HTTP_PROXY || process.env.https_proxy || process.env.HTTPS_PROXY; | |
| let WebSocket = ws.WebSocket | |
| if (httpProxy) { | |
| setGlobalDispatcher(new ProxyAgent(httpProxy)) | |
| const agent = new HttpsProxyAgent(httpProxy) | |
| // @ts-ignore | |
| WebSocket = class extends ws.WebSocket { | |
| constructor(address: string | URL, options: typeof ws.WebSocket) { | |
| super(address, { | |
| ...options, | |
| agent, | |
| }) | |
| } | |
| } | |
| } | |
| export default { fetch, WebSocket, debug } | |