Socket
Socket
Sign inDemoInstall

is-reachable

Package Overview
Dependencies
Maintainers
2
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-reachable

Check if servers are reachable


Version published
Weekly downloads
92K
increased by0.37%
Maintainers
2
Weekly downloads
 
Created
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

Package last updated on 14 Nov 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc