{"_id":"detect-port-alt","maintainers":[{"email":"dan.abramov@gmail.com","name":"gaearon"},{"email":"timer150@gmail.com","name":"timer"}],"keywords":["detect","port"],"dist-tags":{"latest":"1.1.6"},"description":"detect available port","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","repository":{"type":"git","url":"git://github.com/node-modules/detect-port.git"},"bugs":{"url":"https://github.com/node-modules/detect-port/issues"},"license":"MIT","versions":{"1.1.3":{"name":"detect-port-alt","version":"1.1.3","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","gitHead":"5227c3480f766479e29ba4360dc72dc116fb1015","bugs":{"url":"https://github.com/node-modules/detect-port/issues"},"_id":"detect-port-alt@1.1.3","_shasum":"a4d2f061d757a034ecf37c514260a98750f2b131","_from":".","_npmVersion":"3.10.10","_nodeVersion":"6.10.3","_npmUser":{"name":"timer","email":"timer150@gmail.com"},"dist":{"shasum":"a4d2f061d757a034ecf37c514260a98750f2b131","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/detect-port-alt/-/detect-port-alt-1.1.3.tgz","integrity":"sha512-Mo7vtTJBvCsLphxecZllzDq24288TBYPOEP3OyFdbLXxoS6j2Nusl5KWh14z6IG6tskKisUsTc/jPLk2nsQaOw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCyVA+fkET/+RoA+B3V+v/8qCruZKLnOV46qvC7/HVFoAIhAP+7IOW1tGNhLO1hJCQcnwhvnYFUKv5Gtvx046iaKaTM"}]},"maintainers":[{"name":"timer","email":"timer150@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-port-alt-1.1.3.tgz_1496767501472_0.828901851316914"},"directories":{}},"1.1.4":{"name":"detect-port-alt","version":"1.1.4","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","gitHead":"4b78271c33c8c849e87cf55745b4d1c0e2699d51","bugs":{"url":"https://github.com/node-modules/detect-port/issues"},"_id":"detect-port-alt@1.1.4","_npmVersion":"5.6.0","_nodeVersion":"8.6.0","_npmUser":{"name":"gaearon","email":"dan.abramov@gmail.com"},"dist":{"integrity":"sha512-0nbQW2HDyJNju0/5LLDa1f9gvcV0I9Qlj1h4bYZm9X222SX4DeYOKHpqcDOpD3uzDEnZnaFtOJu0VWTvpchX2g==","shasum":"0f07fc122e366b7fcc5058d3f8c9e8e8a5e66226","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/detect-port-alt/-/detect-port-alt-1.1.4.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQD9mGqL2rBTrff/5ogOsKqwqAVsVRK7xOXkPIw47I1oYAIgdCtXW2CYzy8CuIyT9HrWPnuyKWN6XAj0hh3blvesQyA="}]},"maintainers":[{"email":"dan.abramov@gmail.com","name":"gaearon"},{"email":"timer150@gmail.com","name":"timer"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-port-alt-1.1.4.tgz_1515940722776_0.5817398088984191"},"directories":{}},"1.1.5":{"name":"detect-port-alt","version":"1.1.5","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","gitHead":"c7f60306c46222a388fbfde5de8c981a698a581d","bugs":{"url":"https://github.com/node-modules/detect-port/issues"},"_id":"detect-port-alt@1.1.5","_npmVersion":"5.6.0","_nodeVersion":"8.9.1","_npmUser":{"name":"timer","email":"timer150@gmail.com"},"dist":{"integrity":"sha512-PlE9BuBz44BSDV8sJvfUxkGquPcDW4oHSYa5wY4yKj943C2I4xNU5Gd/EFroqdWNur7W6yU2zOLqvmKJCB//aA==","shasum":"a1aa8fc805a4a5df9b905b7ddc7eed036bcce889","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/detect-port-alt/-/detect-port-alt-1.1.5.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCo8jqmoEo0qyKMW4BE29vAxd9surYjWyJuOAZYneW1UQIgWb47HnoQeQRgGo9AZVVlkclD115bFUkWPtliGHlI5K0="}]},"maintainers":[{"email":"dan.abramov@gmail.com","name":"gaearon"},{"email":"timer150@gmail.com","name":"timer"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-port-alt-1.1.5.tgz_1515941905722_0.10624126577749848"},"directories":{}},"1.1.6":{"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","gitHead":"9524aaaf0d4ef1ea64d5d72be765926c2dc94538","bugs":{"url":"https://github.com/node-modules/detect-port/issues"},"_id":"detect-port-alt@1.1.6","_npmVersion":"5.7.1","_nodeVersion":"8.9.1","_npmUser":{"name":"timer","email":"timer150@gmail.com"},"dist":{"integrity":"sha512-5tQykt+LqfJFBEYaDITx7S7cR7mJ/zQmLXZ2qt5w04ainYZw6tBf9dBunMjVeVOdYVRUzUOE4HkY5J7+uttb5Q==","shasum":"24707deabe932d4a3cf621302027c2b266568275","tarball":"https://devel.data-in-motion.biz/nexus/repository/npm-group/detect-port-alt/-/detect-port-alt-1.1.6.tgz","fileCount":13,"unpackedSize":31499,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDhlaHfEaYUeOG0n/H2ZLWnz/xMzklfsIEzQVg1xmYV/AIhANFGs8p12o+7k2MeHjjjIy9dn0BAImIxNBjzWfeI80UV"}]},"maintainers":[{"email":"dan.abramov@gmail.com","name":"gaearon"},{"email":"timer150@gmail.com","name":"timer"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/detect-port-alt_1.1.6_1522799790243_0.22499573668981054"},"_hasShrinkwrap":false}},"name":"detect-port-alt","time":{"1.1.3":"2017-06-06T16:45:02.788Z","1.1.4":"2018-01-14T14:38:43.750Z","1.1.5":"2018-01-14T14:58:26.739Z","1.1.6":"2018-04-03T23:56:30.333Z","created":"2017-06-06T16:45:02.788Z","modified":"2025-05-13T10:27:22.557Z"},"readmeFilename":"README.md","homepage":"https://github.com/node-modules/detect-port"}