Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

azuki-trusty / azk   deb

Repository URL to install this package:

Version: 0.5.1 

is-online Build Status

Check if the internet connection is up

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

In the browser you have navigator.onLine, but it's useless as it only tells you if there's a local connection, and not whether the internet is accessible.

Install

$ npm install --save is-online

Usage

var isOnline = require('is-online');

isOnline(err, online) {
	console.log(online);
	//=> true
});

Node API

isOnline(callback)

callback(error, online)

Required
Type: function

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

Browser API

isOnline(callback)

callback(online)

Required
Type: function

CLI

$ npm install --global is-online
$ is-online --help

  Example
    is-online
    ✔︎ Online

Contributors

License

MIT © Sindre Sorhus