You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It returns true if the TCP port can be listened on, false on Deno.errors.AddrInUse, and rethrows anything else. hostname defaults to 0.0.0.0. I put it in unstable_is_port_available.ts (the @std/net/unstable-is-port-available export), and the JSDoc is upfront that the result is racy, so it points people at port: 0 / getAvailablePort for cases where they own the listener.
It's already written, with tests for the available, in-use, hostname, and non-AddrInUse error cases, and it passes deno task lint, deno fmt --check, and deno test. Can open the PR whenever.
Does that shape look right to you? I can fold in getAvailablePorts(count, options?) too if that's useful, or keep this one small.
Activity
Xavrir commentedon Jun 30, 2026
Happy to take this one. To start small, I'd add a single function alongside
getAvailablePort:It returns
trueif the TCP port can be listened on,falseonDeno.errors.AddrInUse, and rethrows anything else.hostnamedefaults to0.0.0.0. I put it inunstable_is_port_available.ts(the@std/net/unstable-is-port-availableexport), and the JSDoc is upfront that the result is racy, so it points people atport: 0/getAvailablePortfor cases where they own the listener.It's already written, with tests for the available, in-use, hostname, and non-
AddrInUseerror cases, and it passesdeno task lint,deno fmt --check, anddeno test. Can open the PR whenever.Does that shape look right to you? I can fold in
getAvailablePorts(count, options?)too if that's useful, or keep this one small.feat(net): add `isPortAvailable`