JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 51939
  • Score
    100M100P100Q172437F

a simple wrapper for ping

Package Exports

  • ping

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ping) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

#NODE-PING a ping wrapper for nodejs

#LICENSE MIT

(C) Daniel Zelisko

http://github.com/danielzzz/node-ping

#DESCRIPTION

node-ping is a simple wrapper for the system ping utility

#INSTALLATION

npm install ping

#USAGE

##Tradition calls

var ping = require('ping');

var hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];
hosts.forEach(function(host){
    ping.sys.probe(host, function(isAlive){
        var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';
        console.log(msg);
    });
});

##Promise wrapper

var ping = require('ping');

var hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];

hosts.forEach(function (host) {
    ping.promise.probe(host)
        .then(function (res) {
            console.log(res);
        });
});

##Promise Wrapper with configable ping options

//Only promise wrapper supports configable ping options
hosts.forEach(function (host) {
    ping.promise.probe(host, {
        timeout: 10,
        extra: ["-i 2"]
    }).then(function (res) {
            console.log(res);
        });
});