Socket
Socket
Sign inDemoInstall

is-reachable

Package Overview
Dependencies
10
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    is-reachable

Check if servers are reachable


Version published
Weekly downloads
85K
decreased by-10.18%
Maintainers
2
Install size
102 kB
Created
Weekly downloads
 

Readme

Source

is-reachable Build Status

Check if servers are reachable

Works in Node.js and the browser (with browserify).

Install

$ npm install --save is-reachable

Usage

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

isReachable('sindresorhus.com', function (err, reachable) {
	console.log(reachable);
	//=> true
});

isReachable('google.com:80', function (err, reachable) {
	console.log(reachable);
	//=> true
});

Node.js API

isReachable(hosts, callback)

hosts

Type: string, array

One or more hosts to check.

callback(error, reachable)

Type: function

error is there only by Node.js convention and is always null.

reachable

Type: boolean

Is true if any of the hosts are reachable.

Browser API

Same as above except the callback doesn't have an error parameter.

Contributors

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

License

MIT © Sindre Sorhus

Keywords

FAQs

Last updated on 29 Aug 2015

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc