Check if a local or remote port is reachable
npm install is-port-reachable
import isPortReachable from 'is-port-reachable';
console.log(await isPortReachable(80, {host: 'google.com'}));
//=> true
Returns Promise<boolean>
for whether the port is reachable.
Type: number
The port to check.
Type: object
Required
Type: string
Example: 'localhost'
The host to check.
Can be a domain (optionally, with a sub-domain) or an IP address.
Type: number
Default: 1000
The time to wait in milliseconds before giving up.
- is-reachable - Check if servers are reachable