How to use is-port-reachable - 1 common examples

To help you get started, we’ve selected a few is-port-reachable examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github zeit / now / packages / now-static-build / src / index.ts View on Github external
async function checkForPort(
  port: number | undefined,
  timeout: number
): Promise {
  const start = Date.now();
  while (!(await isPortReachable(port))) {
    if (Date.now() - start > timeout) {
      throw new Error(`Detecting port ${port} timed out after ${ms(timeout)}`);
    }
    await sleep(100);
  }
}

is-port-reachable

Check if a local or remote port is reachable

MIT
Latest version published 3 years ago

Package Health Score

74 / 100
Full package analysis

Popular is-port-reachable functions