{ "_from": "ping", "_id": "ping@0.2.2", "_inBundle": false, "_integrity": "sha1-GA+3UIwdx0eThJvONcgHP5llvOI=", "_location": "/ping", "_phantomChildren": {}, "_requested": { "escapedName": "ping", "fetchSpec": "latest", "name": "ping", "raw": "ping", "rawSpec": "", "registry": true, "saveSpec": null, "type": "tag" }, "_requiredBy": [ "#USER", "/" ], "_resolved": "https://registry.npmjs.org/ping/-/ping-0.2.2.tgz", "_shasum": "180fb7508c1dc74793849bce35c8073f9965bce2", "_spec": "ping", "_where": "D:\\Programming\\Projects\\Down-Detector", "author": { "email": "daniel@zelisko.net", "name": "danielzzz", "url": "http://daniel.zelisko.net" }, "bugs": { "url": "https://github.com/danielzzz/node-ping/issues" }, "bundleDependencies": false, "contributors": [ { "name": "Joshua Pruitt", "email": "firefly777@gmail.com" }, { "name": "Mond Wan", "email": "mondwan.1015@gmail.com" }, { "name": "weihua44" }, { "name": "GermanBluefox" }, { "name": "mabukar" }, { "name": "microacup", "email": "xiangmain@gmail.com" }, { "name": "Andrew Fadeev" }, { "name": "dougluce", "email": "doug@tenousiperochhelical.con.com" }, { "name": "Stephan van Rooij", "email": "stephan@svrooij.nl", "url": "http://svrooij.nl" }, { "name": "Krispin Schulz", "email": "krispinone@googlemail.com", "url": "http://kr1sp1n.io" }, { "name": "Kathy Hill" }, { "name": "mrMuppet" }, { "name": "Adam Heath", "email": "adam@adamheath.me", "url": "http://www.adamheath.me" }, { "name": "BlessJah", "email": "blessjah@jacekowski.org" }, { "name": "jritsema" } ], "dependencies": { "q": "1.x", "underscore": "^1.8.3" }, "deprecated": false, "description": "a simple wrapper for ping", "devDependencies": { "babel-eslint": "^7.0.0", "chai": "2.3.0", "eslint": "^3.8.1", "eslint-config-airbnb": "^12.0.0", "eslint-config-eslint": "^3.0.0", "eslint-plugin-import": "^1.16.0", "eslint-plugin-jsx-a11y": "^2.2.3", "eslint-plugin-react": "^6.4.1", "glob": "^7.1.1", "grunt": "^1.0.1", "grunt-mocha-test": "^0.13.2", "gruntify-eslint": "^3.1.0", "mocha": "2.5.3", "sinon": "1.17.6" }, "engines": { "node": ">=0.8" }, "homepage": "http://github.com/danielzzz/node-ping", "license": "MIT", "main": "index.js", "name": "ping", "optionalDependencies": {}, "readme": "#NODE-PING\n\na ping wrapper for nodejs\n\n@last-modified: 2016-10-21 12:43\n\n#LICENSE MIT\n\n(C) Daniel Zelisko\n\nhttp://github.com/danielzzz/node-ping\n\n#DESCRIPTION\n\nnode-ping is a simple wrapper for the system ping utility\n\n#INSTALLATION\n\nnpm install ping\n\n#USAGE\n\nBelow are examples extracted from `examples`\n\n##Tradition calls\n\n```js\nvar ping = require('ping');\n\nvar hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];\nhosts.forEach(function(host){\n ping.sys.probe(host, function(isAlive){\n var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';\n console.log(msg);\n });\n});\n```\n\n##Tradition calls with configuration\n\n```js\nvar cfg = {\n timeout: 10,\n // WARNING: -i 2 may not work in other platform like window\n extra: [\"-i 2\"],\n};\n\nhosts.forEach(function(host){\n ping.sys.probe(host, function(isAlive){\n var msg = isAlive ? 'host ' + host + ' is alive' : 'host ' + host + ' is dead';\n console.log(msg);\n }, cfg);\n});\n```\n\n##Promise wrapper\n\n```js\nvar ping = require('ping');\n\nvar hosts = ['192.168.1.1', 'google.com', 'yahoo.com'];\n\nhosts.forEach(function (host) {\n ping.promise.probe(host)\n .then(function (res) {\n console.log(res);\n });\n});\n```\n\n##Promise Wrapper with configable ping options\n\n```js\nhosts.forEach(function (host) {\n // WARNING: -i 2 argument may not work in other platform like window\n ping.promise.probe(host, {\n timeout: 10,\n extra: [\"-i 2\"],\n }).then(function (res) {\n console.log(res);\n });\n});\n```\n\n### Support configuration\n\nBelow is the possible configuration\n\n```js\n/**\n * Cross platform config representation\n * @typedef {Object} PingConfig\n * @property {boolean} numeric - Map IP address to hostname or not\n * @property {number} timeout - Time duration for ping command to exit\n * @property {number} min_reply - Exit after sending number of ECHO_REQUEST\n * @property {string[]} extra - Optional options does not provided\n */\n```\n\n### Output specification\n\n* For callback based implementaiton:\n\n```js\n/**\n * Callback after probing given host\n * @callback probeCallback\n * @param {boolean} isAlive - Whether target is alive or not\n * @param {Object} error - Null if no error occurs\n */\n```\n\n* For promise based implementation\n\n```js\n/**\n * Parsed response\n * @typedef {object} PingResponse\n * @param {string} host - The input IP address or HOST\n * @param {string} numeric_host - Target IP address\n * @param {boolean} alive - True for existed host\n * @param {string} output - Raw stdout from system ping\n * @param {number} time - Time (float) in ms for first successful ping response\n * @param {string} min - Minimum time for collection records\n * @param {string} max - Maximum time for collection records\n * @param {string} avg - Average time for collection records\n * @param {string} stddev - Standard deviation time for collected records\n */\n```\n\n#### Note\n\n* Since `ping` in this module relies on the `ping` from underlying platform,\narguments in `PingConfig.extra` will definitely be varied across different\nplatforms.\n\n* However, `numeric`, `timeout` and `min_reply` have been abstracted. Values for\nthem are expected to be cross platform.\n\n* By setting `numeric`, `timeout` or `min_reply` to false, you can run `ping`\nwithout corresponding arguments.\n\n# Contributing\n\nBefore opening a pull request please make sure your changes follow the\n[contribution guidelines][1].\n\n[1]: https://github.com/danielzzz/node-ping/blob/master/CONTRIBUTING.md\n", "readmeFilename": "README.md", "repository": { "type": "git", "url": "git://github.com/danielzzz/node-ping.git" }, "scripts": { "test": "grunt test" }, "version": "0.2.2" }