Spaces:
Runtime error
Runtime error
Download src/utils/makeProxyAgent.ts from oex2003/evolution-api: direct link, hf CLI and curl.
- Browser
- Download file 563 Bytes
-
https://huggingface.co/spaces/oex2003/evolution-api/resolve/main/src/utils/makeProxyAgent.ts
- Command line
-
hf download hf://spaces/oex2003/evolution-api/src/utils/makeProxyAgent.ts
-
curl -L -o makeProxyAgent.ts https://huggingface.co/spaces/oex2003/evolution-api/resolve/main/src/utils/makeProxyAgent.ts
563 Bytes
| import { HttpsProxyAgent } from 'https-proxy-agent'; | |
| type Proxy = { | |
| host: string; | |
| password?: string; | |
| port: string; | |
| protocol: string; | |
| username?: string; | |
| }; | |
| export function makeProxyAgent(proxy: Proxy | string) { | |
| if (typeof proxy === 'string') { | |
| return new HttpsProxyAgent(proxy); | |
| } | |
| const { host, password, port, protocol, username } = proxy; | |
| let proxyUrl = `${protocol}://${host}:${port}`; | |
| if (username && password) { | |
| proxyUrl = `${protocol}://${username}:${password}@${host}:${port}`; | |
| } | |
| return new HttpsProxyAgent(proxyUrl); | |
| } | |