Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/andrelmlins/choose-port

Choose an available port
https://github.com/andrelmlins/choose-port

choose choose-port host port server

Last synced: 1 day ago
JSON representation

Choose an available port

Awesome Lists containing this project

README

        

# Choose Port

Choose an available port

[![npm version](https://badge.fury.io/js/choose-port.svg)](https://www.npmjs.com/package/choose-port) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://github.com/andrelmlins/choose-port/blob/master/LICENSE) [![Build Status](https://travis-ci.com/andrelmlins/choose-port.svg?branch=master)](https://travis-ci.com/andrelmlins/choose-port) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/andrelmlins/choose-port.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/andrelmlins/choose-port/context:javascript)

## Install

```
npm install choose-port
```

or

```
yarn add choose-port
```

## Usage

**Call Async**

```js
const choosePort = require('choose-port');

choosePort(8000, '127.0.0.1', portValid => {
console.log('Chosen port:', portValid);
});
```

**Call Sync**

```js
const { choosePortSync } = require('choose-port');

const portValid = choosePortSync(8000, '127.0.0.1');

console.log(portValid);
```

## NPM Statistics

Download stats for this NPM package

[![NPM](https://nodei.co/npm/choose-port.png)](https://nodei.co/npm/choose-port/)

## License

Choose Port is open source software [licensed as MIT](https://github.com/andrelmlins/choose-port/blob/master/LICENSE).