Have opinions about JavaScript? We want to hear them. Take the 2018 JavaScript Ecosystem Survey »

is-port-reachable

2.0.0 • Public • Published

is-port-reachable Build Status

Check if a local or remote port is reachable

Install

$ npm install --save is-port-reachable

Usage

const isPortReachable = require('is-port-reachable');
 
isPortReachable(80, {host: 'google.com'}).then(reachable => {
    console.log(reachable);
    //=> true
});

API

isPortReachable(port, [options])

Returns a Promise for a boolean.

port

Type: number

options

host

Type: string
Default: localhost

Can be a domain or an IP.

timeout

Type: number
Default: 1000

Milliseconds to wait before giving up.

Related

License

MIT © Sindre Sorhus

install

npm i is-port-reachable

Downloadsweekly downloads

18,938

version

2.0.0

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability