1.0.2 • Published 2 years ago

@meslzy/port v1.0.2

Weekly downloads
-
License
mit
Repository
github
Last release
2 years ago

Port (✨)

Find available ports


stars forks issues


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
});

The End (💘)

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

3 years ago

0.0.1-dev

3 years ago