0.2.0 • Published 9 years ago
start-free-port v0.2.0
start-free-port
Task for Start to find a free port from specified range.
Install
npm install --save-dev start-free-port
# or
yarn add --dev start-free-portUsage
import start from 'start';
import reporter from 'start-pretty-reporter';
import freePort from 'start-free-port';
import * as webpack from 'start-webpack';
const minPort = 3000;
const maxPort = 3099;
export const dev = () => start(reporter())(
freePort({ minPort, maxPort }, port => start(
webpack.dev(require('./conf/webpack.dev'), port)
))
);Arguments
freePort(options, callback)
optionsminPort–49152by defaultmaxPort–65535by defaulthost–'127.0.0.1'by default
callback– callback function which will be called with found port
List of TCP and UDP port numbers:
The range 49152–65535 contains dynamic or private ports that cannot be registered with IANA. This range is used for private, or customized services or temporary purposes and for automatic allocation of ephemeral ports.