Interface INetwork

interface INetwork {
    findAvailablePort: () => Promise<number>;
    getInterfaces: () => Promise<NetworkInterface[]>;
    getNonEmptyInterfaces: () => Promise<NetworkInterface[]>;
    isHttpPortOpen: (
        ip: string,
        options?: {
            keyword?: string;
            port: number;
            protocol?: "http" | "https";
            route?: string;
            statusCode?: number;
        },
    ) => Promise<boolean>;
    isPortTaken: (port: number) => Promise<boolean>;
}

Properties

findAvailablePort: () => Promise<number>
getInterfaces: () => Promise<NetworkInterface[]>
getNonEmptyInterfaces: () => Promise<NetworkInterface[]>
isHttpPortOpen: (
    ip: string,
    options?: {
        keyword?: string;
        port: number;
        protocol?: "http" | "https";
        route?: string;
        statusCode?: number;
    },
) => Promise<boolean>

Type declaration

    • (
          ip: string,
          options?: {
              keyword?: string;
              port: number;
              protocol?: "http" | "https";
              route?: string;
              statusCode?: number;
          },
      ): Promise<boolean>
    • Check if an http service is on given ip and port, and optional keyword, route, protocol By default, it will send a get request to http://<ip>:<port> to see it a response is received. If route is provided, it will send a get request to http://<ip>:<port>/<route> If keyword is provided, it will check if the response contains the keyword (case insensitive)

      Parameters

      • ip: string
      • Optionaloptions: {
            keyword?: string;
            port: number;
            protocol?: "http" | "https";
            route?: string;
            statusCode?: number;
        }

      Returns Promise<boolean>

isPortTaken: (port: number) => Promise<boolean>

Type declaration

    • (port: number): Promise<boolean>
    • This command doesn't work yet

      Parameters

      • port: number

      Returns Promise<boolean>