Spaces:
Sleeping
Sleeping
Download test/test-get-ip.js from AZILS/antigravity2api2: direct link, hf CLI and curl.
- Browser
- Download file 544 Bytes
-
https://huggingface.co/spaces/AZILS/antigravity2api2/resolve/main/test/test-get-ip.js
- Command line
-
hf download hf://spaces/AZILS/antigravity2api2/test/test-get-ip.js
-
curl -L -o test-get-ip.js https://huggingface.co/spaces/AZILS/antigravity2api2/resolve/main/test/test-get-ip.js
544 Bytes
| import os from 'os'; | |
| function getLocalIp() { | |
| const interfaces = os.networkInterfaces(); | |
| console.log(JSON.stringify(interfaces, null, 2)) | |
| if (interfaces.WLAN) { | |
| for (const inter of interfaces.WLAN) { | |
| if (inter.family === 'IPv4' && !inter.internal) { | |
| return inter.address; | |
| } | |
| } | |
| } else if (interfaces.wlan2) { | |
| for (const inter of interfaces.wlan2) { | |
| if (inter.family === 'IPv4' && !inter.internal) { | |
| return inter.address; | |
| } | |
| } | |
| return '127.0.0.1'; | |
| } | |
| } | |
| console.log(getLocalIp()); | |