UNPKG

get-public-ipv4

Version:

Fetches the public IP address using the ipify.org API

11 lines (9 loc) 235 B
const getPublicIP = require("get-public-ipv4"); (async () => { try { const ip = await getPublicIP(); console.log("Public IP:", ip); } catch (err) { console.error("Failed to fetch public IP:", err); } })();