@types/porty
TypeScript icon, indicating that this package has built-in type declarations

3.1.0 • Public • Published

Installation

npm install --save @types/porty

Summary

This package contains type definitions for porty (https://github.com/AlexanderElias/porty#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/porty.

index.d.ts

export interface FindOptions {
    /** Ports to avoid */
    avoids?: readonly number[] | undefined;
    /**
     * Minimum port.
     * @default 8000
     */
    min?: number | undefined;
    /**
     * Maximum port.
     * @default 10000
     */
    max?: number | undefined;
    /**
     * @internal
     * The current port to check.
     * This is an internal value, initialized and incremented
     * while {@link find} is run, and starts at {@link min} if unspecified.
     * It is unlikely that this needs to be set manually
     */
    port?: number | undefined;
}

/**
 * Test if a port on the system is free
 * @param port The port to test
 */
export function test(port: number): Promise<boolean>;

/**
 * Find an available port on the system in a range
 * @param options Optional config options
 * @returns The port found, if available
 */
export function find(options?: FindOptions): Promise<number>;
/**
 * Find an available port on the system in a range
 * @param min The minimum port. Defaults to 8000
 * @param max The maximum port. Defaults to 10000
 * @param avoids Ports to avoid
 */
export function find(min?: number, max?: number, avoids?: readonly number[]): Promise<number>;

export { find as get };

Additional Details

  • Last updated: Tue, 07 Nov 2023 21:36:25 GMT
  • Dependencies: none

Credits

These definitions were written by Adam Thompson-Sharpe.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/porty

Weekly Downloads

17

Version

3.1.0

License

MIT

Unpacked Size

4.99 kB

Total Files

5

Last publish

Collaborators

  • types