@meslzy/port
v1.0.2
Published
Find available ports
Downloads
9
Readme
Port (✨)
Find available ports
Getting Started (✅)
Installation (⏬)
npm install @meslzy/port
Usage (📙)
port.isPortAvailable(3000).then((available) => {
console.log(available); // true | false
});
interface AvailablePortsOptions {
/**
* Minimum port number
* @default 1023
**/
min?: number;
/**
* Maximum port number
* @default 65535
**/
max?: number;
/**
* Maximum number of ports to return
**/
limit?: number;
/**
* Ports to include
**/
include?: number[];
/**
* Ports to exclude
**/
exclude?: number[];
}
port.getAvailablePorts(AvailablePortsOptions).then((ports) => {
console.log(ports); // available from 1023 to 65535
});
interface AvailablePortOptions {
/**
* Minimum port number
* @default 1023
**/
min?: number;
/**
* Maximum port number
* @default 65535
**/
max?: number;
/**
* Ports to include
**/
include?: number[];
/**
* Ports to exclude
**/
exclude?: number[];
}
port.getAvailablePort(AvailablePortOptions).then((port) => {
console.log(port); // available from 1023 to 65535
});