goldies
    Preparing search index...

    Function getAvailablePort

    • Finds an available port for listening.

      Parameters

      • startingAt: number = 3000

        Port to begin scanning from (default: 3000).

      Returns Promise<number>

      A Promise that resolves to an unused port number.

      If no available port is found in the range 3000-65535.

      const port = await getAvailablePort(8080);
      console.log(`${port} is available`);