Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/node-modules/detect-port
Node.js module to detect available ports of the system.
https://github.com/node-modules/detect-port
detector free nodejs port
Last synced: 11 days ago
JSON representation
Node.js module to detect available ports of the system.
- Host: GitHub
- URL: https://github.com/node-modules/detect-port
- Owner: node-modules
- License: mit
- Created: 2015-05-30T02:50:53.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2024-05-29T16:01:45.000Z (5 months ago)
- Last Synced: 2024-10-16T06:16:42.020Z (20 days ago)
- Topics: detector, free, nodejs, port
- Language: JavaScript
- Homepage:
- Size: 119 KB
- Stars: 380
- Watchers: 14
- Forks: 28
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
- awesome-nodejs - detect-port - Node.js implementation of port detector. ![](https://img.shields.io/github/stars/node-modules/detect-port.svg?style=social&label=Star) (Repository / Network)
- awesome-github-star - detect-port - modules | 354 | (JavaScript)
- awesome-packages - detect-port
README
[![logo][logo-image]][logo-url]
---
[![NPM version][npm-image]][npm-url]
[![build status][travis-image]][travis-url]
[![Test coverage][codecov-image]][codecov-url]
[![npm download][download-image]][download-url][logo-image]: ./logo.png
[logo-url]: https://npmjs.org/package/detect-port
[npm-image]: https://img.shields.io/npm/v/detect-port.svg
[npm-url]: https://npmjs.org/package/detect-port
[travis-image]: https://img.shields.io/travis/node-modules/detect-port.svg
[travis-url]: https://travis-ci.org/node-modules/detect-port
[codecov-image]: https://img.shields.io/coveralls/node-modules/detect-port.svg
[codecov-url]: https://codecov.io/gh/node-modules/detect-port
[download-image]: https://img.shields.io/npm/dm/detect-port.svg
[download-url]: https://npmjs.org/package/detect-port> Node.js implementation of port detector
## Who are using or has used
- ⭐⭐⭐[eggjs/egg](//github.com/eggjs/egg)
- ⭐⭐⭐[alibaba/ice](//github.com/alibaba/ice)
- ⭐⭐⭐[alibaba/uirecorder](//github.com/alibaba/uirecorder)
- ⭐⭐⭐[facebook/create-react-app](//github.com/facebook/create-react-app/blob/main/packages/react-dev-utils/package.json)
- ⭐⭐⭐[facebook/flipper](//github.com/facebook/flipper)
- ⭐⭐⭐[umijs/umi](//github.com/umijs/umi)
- ⭐⭐⭐[gatsbyjs/gatsby](//github.com/gatsbyjs/gatsby)
- ⭐⭐⭐[electron-react-boilerplate/electron-react-boilerplate](//github.com/electron-react-boilerplate/electron-react-boilerplate)
- ⭐⭐⭐[zeit/micro](//github.com/zeit/micro)
- ⭐⭐⭐[rails/webpacker](//github.com/rails/webpacker)
- ⭐⭐⭐[storybookjs/storybook](//github.com/storybookjs/storybook)[For more](//github.com/node-modules/detect-port/network/dependents)
## Usage
```bash
$ npm i detect-port --save
``````javascript
const detect = require('detect-port');
/**
* use as a promise
*/detect(port)
.then(_port => {
if (port == _port) {
console.log(`port: ${port} was not occupied`);
} else {
console.log(`port: ${port} was occupied, try port: ${_port}`);
}
})
.catch(err => {
console.log(err);
});```
## Command Line Tool
```bash
$ npm i detect-port -g
```### Quick Start
```bash
# get an available port randomly
$ detect# detect pointed port
$ detect 80# output verbose log
$ detect --verbose# more help
$ detect --help
```## FAQ
Most likely network error, check that your `/etc/hosts` and make sure the content below:
```
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
```## Contributors
|[
xudafeng](https://github.com/xudafeng)
|[
fengmk2](https://github.com/fengmk2)
|[
ziczhu](https://github.com/ziczhu)
|[
gaearon](https://github.com/gaearon)
|[
chnliquan](https://github.com/chnliquan)
|[
popomore](https://github.com/popomore)
|
| :---: | :---: | :---: | :---: | :---: | :---: |
[
snapre](https://github.com/snapre)
|[
yavuzakyuz](https://github.com/yavuzakyuz)
|[
antife-yinyue](https://github.com/antife-yinyue)This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Wed Sep 21 2022 23:10:27 GMT+0800`.
## License
[MIT](LICENSE)