index.d.ts 1.0 KB

123456789101112131415161718192021222324252627
  1. declare function isUnsafePort(port: number): boolean;
  2. declare function isSafePort(port: number): boolean;
  3. interface GetPortOptions {
  4. name: string;
  5. random: boolean;
  6. port: number;
  7. ports: number[];
  8. portRange: [from: number, to: number];
  9. host: string;
  10. memoDir: string;
  11. memoName: string;
  12. }
  13. declare type GetPortInput = Partial<GetPortOptions> | number | string;
  14. declare type HostAddress = undefined | string;
  15. declare type PortNumber = number;
  16. declare function getPort(config?: GetPortInput): Promise<PortNumber>;
  17. declare function getRandomPort(host?: HostAddress): Promise<number>;
  18. interface WaitForPortOptions {
  19. host?: HostAddress;
  20. delay?: number;
  21. retries?: number;
  22. }
  23. declare function waitForPort(port: PortNumber, opts?: WaitForPortOptions): Promise<void>;
  24. declare function checkPort(port: PortNumber, host?: HostAddress | HostAddress[]): Promise<PortNumber | false>;
  25. export { GetPortInput, GetPortOptions, HostAddress, PortNumber, WaitForPortOptions, checkPort, getPort, getRandomPort, isSafePort, isUnsafePort, waitForPort };