node-modules/detect-port

Name: detect-port

Owner: node_modules

Description: Node.js implementation of port detector

Created: 2015-05-30 02:50:53.0

Updated: 2018-05-24 09:44:00.0

Pushed: 2018-05-16 13:26:48.0

Homepage:

Size: 71

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

logo


NPM version build status Test coverage npm download

Node.js implementation of port detector

Usage
m i detect-port --save
avascript
t detect = require('detect-port');


allback usage


ct(port, (err, _port) => {
 (err) {
console.log(err);


 (port == _port) {
console.log(`port: ${port} was not occupied`);
else {
console.log(`port: ${port} was occupied, try port: ${_port}`);




or a yield syntax instead of callback function implement


t co = require('co');

unction *() {
nst _port = yield detect(port);

 (port == _port) {
console.log(`port: ${port} was not occupied`);
else {
console.log(`port: ${port} was occupied, try port: ${_port}`);




se as a promise


ct(port)
hen(_port => {
if (port == _port) {
  console.log(`port: ${port} was not occupied`);
} else {
  console.log(`port: ${port} was occupied, try port: ${_port}`);
}

atch(err => {
console.log(err);
;
Command Line Tool
m i detect-port -g
Quick Start
t an available port randomly
tect

tect pointed port
tect 80

tput verbose log
tect --verbose

re help
tect --help
FAQ

Most likely network error, check that your /etc/hosts and make sure the content below:

0.0.1       localhost
255.255.255 broadcasthost
            localhost
Contributors

|
xudafeng

|
fengmk2

|
ziczhu

|
gaearon

|
jsw0528

| :—: | :—: | :—: | :—: | :—: |

This project follows the git-contributor spec, auto upated at Sat Apr 21 2018 17:33:10 GMT+0800.

License

MIT


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.