/** Ports range from 0 to 65535 */ export declare const LAST_PORT: number; /** System ports (which require root to bind to) range from 0 to 1023 */ export declare const LAST_SYSTEM_PORT: number; /** Set of ports that are marked as reserved. * Can check if a port is available. * Can return random or incremental free ports, * with optional preferred default port. */ export declare class PortManager extends Set { /** Mark a port as reserved. */ reserve(port: string | number): boolean; /** Unmark a port as reserved. */ unreserve(port: string | number): boolean; /** Mark a port as reserved, throw if it's already in use. */ tryReservePort(port: string | number): Promise; /** Unmark a port as reserved, throw if it's still in use. */ tryUnreserve(port: string | number): Promise; /** Return true if port is marked as reserved. */ isReserved(port: string | number): boolean; /** Return true if port is not marked as reserved. */ isNotReserved(port: string | number): boolean; /** If a port is in use, mark it as reserved and return true. * Otherwise unmark it as reserved and return false. */ isInUse(port: string | number): Promise; /** Return true if port is not in use. */ isNotInUse(port: string | number): Promise; /** Return the preferred port number or the first free port after it. */ getFreePort(preferred?: string | number, system?: boolean): Promise; /** Return the preferred port number or a random free port. */ getRandomFreePort(preferred?: string | number, system?: boolean): Promise; /** Check whether all ports that are marked as reserved are still reserved. * Remove from the set of reserved ports those that are not in use anymore. */ refresh(): Promise; } declare const _default: PortManager; export default _default; export declare function toPortNumber(port: string | number): number; export declare function isPortTaken(port: number): Promise; /** Get a random free port number by briefly running a server on a random unused port, * then stopping the server and returning the port number. */ export declare function freePort(): Promise; /** Get a random port number between 1024 and 65535, * (or between 0 and 65535 if you pass `true` to include system ports) */ export declare function getRandomPortNumber(system?: boolean): number; export { backOff } from 'exponential-backoff'; export * from "./port-endpoint.dist"; export * from "./port-wait.dist"; //# sourceMappingURL=port.d.ts.map