Utils to deal with TCP ports and hostnames. Safe for everyday use.
npm install endpoint-utils
Get free port
const getFreePort = getFreePort;;
Get multiple free ports
const getFreePorts = getFreePorts;;
Check if port is free
const isFreePort = isFreePort;;
Check if hostname or IP address resolves to the current machine
const isMyHostname = isMyHostname;;;
Get hostname or IP address which can be resolved to the current machine
const getMyHostname = getMyHostname;;
Get IP address of current machine
const getIPAddress = getIPAddress;console;//> "172.22.5.80"