{ "manifest": { "name": "detect-port-alt", "version": "1.1.6", "description": "detect available port", "keywords": [ "detect", "port" ], "bin": { "detect": "bin/detect-port", "detect-port": "bin/detect-port" }, "main": "index.js", "repository": { "type": "git", "url": "git://github.com/node-modules/detect-port.git" }, "dependencies": { "address": "^1.0.1", "debug": "^2.6.0" }, "devDependencies": { "command-line-test": "^1.0.8", "egg-bin": "^1.10.3", "egg-ci": "^1.1.0", "eslint": "^3.13.1", "eslint-config-egg": "^3.1.0", "pedding": "^1.1.0" }, "scripts": { "test": "egg-bin test", "ci": "npm run lint && egg-bin cov", "lint": "eslint ." }, "engines": { "node": ">= 4.2.1" }, "ci": { "version": "4, 6, 7" }, "homepage": "https://github.com/node-modules/detect-port", "license": "MIT", "_registry": "npm", "_loc": "/home/josie/.cache/yarn/v6/npm-detect-port-alt-1.1.6-integrity/node_modules/detect-port-alt/package.json", "readmeFilename": "README.md", "readme": "[![logo][logo-image]][logo-url]\n\n---\n\n[![NPM version][npm-image]][npm-url]\n[![build status][travis-image]][travis-url]\n[![Test coverage][codecov-image]][codecov-url]\n[![npm download][download-image]][download-url]\n\n[logo-image]: ./logo.png\n[logo-url]: https://npmjs.org/package/detect-port\n[npm-image]: https://img.shields.io/npm/v/detect-port.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/detect-port\n[travis-image]: https://img.shields.io/travis/node-modules/detect-port.svg?style=flat-square\n[travis-url]: https://travis-ci.org/node-modules/detect-port\n[codecov-image]: https://codecov.io/gh/node-modules/detect-port/branch/master/graph/badge.svg\n[codecov-url]: https://codecov.io/gh/node-modules/detect-port\n[download-image]: https://img.shields.io/npm/dm/detect-port.svg?style=flat-square\n[download-url]: https://npmjs.org/package/detect-port\n\n> JavaScript Implementation of Port Detector\n\n## Usage\n\n```bash\n$ npm i detect-port --save\n```\n\n```js\nconst detect = require('detect-port');\n\n/**\n * callback usage\n */\n\ndetect(port, (err, _port) => {\n if (err) {\n console.log(err);\n }\n\n if (port == _port) {\n console.log(`port: ${port} was not occupied`);\n } else {\n console.log(`port: ${port} was occupied, try port: ${_port}`);\n }\n});\n\n/**\n * for a yield syntax instead of callback function implement\n */\n\nconst co = require('co');\n\nco(function *() {\n const _port = yield detect(port);\n\n if (port == _port) {\n console.log(`port: ${port} was not occupied`);\n } else {\n console.log(`port: ${port} was occupied, try port: ${_port}`);\n }\n});\n\n/**\n * use as a promise\n */\n\ndetect(port)\n .then(_port => {\n if (port == _port) {\n console.log(`port: ${port} was not occupied`);\n } else {\n console.log(`port: ${port} was occupied, try port: ${_port}`);\n }\n })\n .catch(err => {\n console.log(err);\n });\n\n```\n\n## Command Line Tool\n\n```shell\n$ npm i detect-port -g\n```\n\n### Quick Start\n\n```shell\n# get an available port randomly\n$ detect\n\n# detect pointed port\n$ detect 80\n\n# more help\n$ detect --help\n```\n\n## Authors\n\n- [xudafeng](//github.com/xudafeng)\n- [zenzhu](//github.com/zenzhu)\n\n## License\n\n[MIT](LICENSE)\n", "licenseText": "The MIT License (MIT)\n\nCopyright (c) 2015 xdf\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n" }, "artifacts": [], "remote": { "resolved": "https://registry.npmjs.org/detect-port-alt/-/detect-port-alt-1.1.6.tgz", "type": "tarball", "reference": "https://registry.npmjs.org/detect-port-alt/-/detect-port-alt-1.1.6.tgz", "hash": "", "integrity": "sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==", "registry": "npm", "packageName": "detect-port-alt", "cacheIntegrity": "sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q== sha1-JHB96r6TLUo89iEwICfCsmZWgnU=" }, "registry": "npm", "hash": "e6d43292df8ba9f24504461a0c84f1ed2edc47b989ff34262d7676aade70d386a29d8670ead05ff5d06e9cc8d579539d615454cd4384e07918e49efebadb5be5" }