Node.js module to detect available ports of the system.
Installations
npm install detect-port
Developer
node-modules
Developer Guide
Module System
CommonJS
Min. Node Version
>= 4.0.0
Typescript Support
No
Node Version
18.20.2
NPM Version
10.5.0
Statistics
380 Stars
83 Commits
28 Forks
15 Watching
3 Branches
27 Contributors
Updated on 15 Oct 2024
Languages
JavaScript (100%)
Total Downloads
Cumulative downloads
Total Downloads
1,078,979,587
Last day
-2.3%
1,027,432
Compared to previous day
Last week
3.2%
5,351,346
Compared to previous week
Last month
9.1%
22,900,817
Compared to previous month
Last year
9.7%
297,541,402
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Node.js implementation of port detector
Who are using or has used
- ⭐⭐⭐eggjs/egg
- ⭐⭐⭐alibaba/ice
- ⭐⭐⭐alibaba/uirecorder
- ⭐⭐⭐facebook/create-react-app
- ⭐⭐⭐facebook/flipper
- ⭐⭐⭐umijs/umi
- ⭐⭐⭐gatsbyjs/gatsby
- ⭐⭐⭐electron-react-boilerplate/electron-react-boilerplate
- ⭐⭐⭐zeit/micro
- ⭐⭐⭐rails/webpacker
- ⭐⭐⭐storybookjs/storybook
Usage
1$ npm i detect-port --save
1const detect = require('detect-port'); 2/** 3 * use as a promise 4 */ 5 6detect(port) 7 .then(_port => { 8 if (port == _port) { 9 console.log(`port: ${port} was not occupied`); 10 } else { 11 console.log(`port: ${port} was occupied, try port: ${_port}`); 12 } 13 }) 14 .catch(err => { 15 console.log(err); 16 }); 17
Command Line Tool
1$ npm i detect-port -g
Quick Start
1# get an available port randomly 2$ detect 3 4# detect pointed port 5$ detect 80 6 7# output verbose log 8$ detect --verbose 9 10# more help 11$ 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 | fengmk2 | ziczhu | gaearon | chnliquan | popomore |
---|---|---|---|---|---|
snapre | yavuzakyuz | antife-yinyue |
This project follows the git-contributor spec, auto updated at Wed Sep 21 2022 23:10:27 GMT+0800
.
License
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
0 existing vulnerabilities detected
Reason
SAST tool detected but not run on all commits
Details
- Info: SAST configuration detected: CodeQL
- Warn: 1 commits out of 12 are checked with a SAST tool
Reason
Found 8/30 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:41: update your workflow using https://app.stepsecurity.io/secureworkflow/node-modules/detect-port/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/node-modules/detect-port/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/node-modules/detect-port/codeql-analysis.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/codeql-analysis.yml:72: update your workflow using https://app.stepsecurity.io/secureworkflow/node-modules/detect-port/codeql-analysis.yml/master?enable=pin
- Info: 0 out of 4 GitHub-owned GitHubAction dependencies pinned
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Info: jobLevel 'actions' permission set to 'read': .github/workflows/codeql-analysis.yml:28
- Info: jobLevel 'contents' permission set to 'read': .github/workflows/codeql-analysis.yml:29
- Warn: no topLevel permission defined: .github/workflows/codeql-analysis.yml:1
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Warn: no topLevel permission defined: .github/workflows/release.yml:1
- Info: no jobLevel write permissions found
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Score
4.5
/10
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More