Socket
Socket
Sign inDemoInstall

detect-port

Package Overview
Dependencies
3
Maintainers
3
Versions
30
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.0 to 1.4.0

bin/detect-port.js

1

index.js
'use strict';
module.exports = require('./lib/detect-port');
module.exports.waitPort = require('./lib/wait-port');

2

lib/detect-port.js

@@ -54,3 +54,3 @@ 'use strict';

if (err.code === 'EADDRNOTAVAIL') {
return callback(new Error('the ip that is not unkonwn on the machine'));
return callback(new Error('the ip that is not unknown on the machine'));
}

@@ -57,0 +57,0 @@ return handleError();

{
"name": "detect-port",
"version": "1.3.0",
"version": "1.4.0",
"description": "Node.js implementation of port detector",

@@ -10,9 +10,9 @@ "keywords": [

"bin": {
"detect": "./bin/detect-port",
"detect-port": "./bin/detect-port"
"detect": "./bin/detect-port.js",
"detect-port": "./bin/detect-port.js"
},
"main": "index.js",
"files": [
"bin",
"lib",
"bin/**/*.js",
"lib/**/*.js",
"index.js"

@@ -26,13 +26,14 @@ ],

"address": "^1.0.1",
"debug": "^2.6.0"
"debug": "4"
},
"devDependencies": {
"command-line-test": "^1.0.8",
"egg-bin": "^1.10.3",
"command-line-test": "1",
"egg-bin": "5",
"egg-ci": "^1.1.0",
"eslint": "^3.13.1",
"eslint": "^6.1.0",
"eslint-config-egg": "^3.1.0",
"git-contributor": "^1.0.8",
"git-contributor": "1",
"mm": "^2.1.0",
"pedding": "^1.1.0"
"pedding": "^1.1.0",
"power-assert": "^1.6.1"
},

@@ -45,7 +46,4 @@ "scripts": {

},
"engines": {
"node": ">= 4.2.1"
},
"ci": {
"version": "4, 6, 8, 10"
"version": "16"
},

@@ -52,0 +50,0 @@ "homepage": "https://github.com/node-modules/detect-port",

@@ -12,9 +12,9 @@ [![logo][logo-image]][logo-url]

[logo-url]: https://npmjs.org/package/detect-port
[npm-image]: https://img.shields.io/npm/v/detect-port.svg?style=flat-square
[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?style=flat-square
[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?style=flat-square
[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?style=flat-square
[download-image]: https://img.shields.io/npm/dm/detect-port.svg
[download-url]: https://npmjs.org/package/detect-port

@@ -24,2 +24,18 @@

## 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

@@ -33,36 +49,3 @@

const detect = require('detect-port');
/**
* callback usage
*/
detect(port, (err, _port) => {
if (err) {
console.log(err);
}
if (port == _port) {
console.log(`port: ${port} was not occupied`);
} else {
console.log(`port: ${port} was occupied, try port: ${_port}`);
}
});
/**
* for a yield syntax instead of callback function implement
*/
const co = require('co');
co(function *() {
const _port = yield detect(port);
if (port == _port) {
console.log(`port: ${port} was not occupied`);
} else {
console.log(`port: ${port} was occupied, try port: ${_port}`);
}
});
/**
* use as a promise

@@ -121,8 +104,8 @@ */

|[<img src="https://avatars1.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars0.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars1.githubusercontent.com/u/1044425?v=4" width="100px;"/><br/><sub><b>ziczhu</b></sub>](https://github.com/ziczhu)<br/>|[<img src="https://avatars0.githubusercontent.com/u/810438?v=4" width="100px;"/><br/><sub><b>gaearon</b></sub>](https://github.com/gaearon)<br/>|[<img src="https://avatars1.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|[<img src="https://avatars2.githubusercontent.com/u/197375?v=4" width="100px;"/><br/><sub><b>jsw0528</b></sub>](https://github.com/jsw0528)<br/>
|[<img src="https://avatars.githubusercontent.com/u/1011681?v=4" width="100px;"/><br/><sub><b>xudafeng</b></sub>](https://github.com/xudafeng)<br/>|[<img src="https://avatars.githubusercontent.com/u/156269?v=4" width="100px;"/><br/><sub><b>fengmk2</b></sub>](https://github.com/fengmk2)<br/>|[<img src="https://avatars.githubusercontent.com/u/1044425?v=4" width="100px;"/><br/><sub><b>ziczhu</b></sub>](https://github.com/ziczhu)<br/>|[<img src="https://avatars.githubusercontent.com/u/810438?v=4" width="100px;"/><br/><sub><b>gaearon</b></sub>](https://github.com/gaearon)<br/>|[<img src="https://avatars.githubusercontent.com/u/34906299?v=4" width="100px;"/><br/><sub><b>chnliquan</b></sub>](https://github.com/chnliquan)<br/>|[<img src="https://avatars.githubusercontent.com/u/360661?v=4" width="100px;"/><br/><sub><b>popomore</b></sub>](https://github.com/popomore)<br/>|
| :---: | :---: | :---: | :---: | :---: | :---: |
[<img src="https://avatars.githubusercontent.com/u/52845048?v=4" width="100px;"/><br/><sub><b>snapre</b></sub>](https://github.com/snapre)<br/>|[<img src="https://avatars.githubusercontent.com/u/197375?v=4" width="100px;"/><br/><sub><b>antife-yinyue</b></sub>](https://github.com/antife-yinyue)<br/>
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto updated at `Sun Mar 20 2022 00:27:07 GMT+0800`.
This project follows the git-contributor [spec](https://github.com/xudafeng/git-contributor), auto upated at `Tue Aug 14 2018 12:43:52 GMT+0800`.
<!-- GITCONTRIBUTOR_END -->

@@ -129,0 +112,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc