| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/get-port-please/ |
Upload File : |

# get-port-please
> Get an available TCP port to listen
[](https://npmjs.com/package/get-port-please)
[](https://npmjs.com/package/get-port-please)
## Usage
Install package:
```bash
yarn add get-port-please
# or
npm install get-port-please
```
```js
// ESM
import { getPort, checkPort, getRandomPort, waitForPort } from 'get-port-please'
// CommonJS
const { getPort, checkPort, getRandomPort, waitForPort } = require('get-port-please')
```
```ts
getPort(options?: GetPortOptions): Promise<number>
checkPort(port: number, host?: string): Promise<number | false>
waitForPort(port: number, options): Promise<number | false>
```
Try sequence is: port > ports > memo > random
## Options
```ts
interface GetPortOptions {
name?: string
random?: boolean
port?: number
portRange?: [from: number, to: number]
ports?: number[]
host?: string
memoDir?: string
memoName?: string
}
```
### `name`
Unique name for port memorizing. Default is `default`.
### `random`
If enabled, `port` and `ports` will be ignored. Default is `false`.
### `port`
First port to check. Default is `process.env.PORT || 3000`
### `ports`
Alternative ports to check.
### `portRange`
Alternative port range to check. Default is `[3000, 3100]`
### `host`
The host to check. Default is `process.env.HOST` otherwise all available hosts will be checked.
### `memoDir` / `memoName`
Options passed to [fs-memo](https://github.com/unjs/fs-memo)
- Default dir: `node_modules/get-port/dist`
- Default name: `.get-port`
## License
MIT