Awesome Open Source
Awesome Open Source


Check if servers are reachable

Works in Node.js and the browser (with a bundler).

The Node.js version will do a TCP handshake with the target's port. It attempts to detect cases where a router redirects the request to itself.

The browser version is limited by the fact that browsers cannot connect to arbitrary ports. It only supports HTTP and HTTPS and the check relies on the /favicon.ico path being present.


$ npm install is-reachable


const isReachable = require('is-reachable');

(async () => {
	console.log(await isReachable(''));
	//=> true

	console.log(await isReachable(''));
	//=> true


isReachable(targets, options?)

Returns a Promise<boolean> which is true if any of the targets are reachable.


Type: string | string[]

One or more targets to check. Can either be hostname:port, a URL like https://hostname:port or even just hostname. port must be specified if protocol is not http: or https: and defaults to 443. Protocols other than http: and https: are not supported.


Type: object


Type: number
Default: 5000

Timeout in milliseconds after which a request is considered failed.

Node.js only


  • is-online - Check if the internet connection is up


Get A Weekly Email With Trending Projects For These Topics
No Spam. Unsubscribe easily at any time.
javascript (70,894
nodejs (3,861
network (484
browser (470
internet (58
online (57
ping (50
detect (25
connectivity (16