Function getAvailablePort

  • Returns an available network port.

    [!IMPORTANT] In most cases, this function is not needed. Do not use it for trivial uses such as when using Deno.serve or Deno.listen directly. Instead, set the port option to 0 to automatically use an available port, then get the assigned port from the function's return object (see "Recommended Usage" example).

    Parameters

    Returns number

    An available network port.