// Requires `--allow-net` flag
import {
isFreePort,
getFreePort,
} from 'https://deno.land/x/free_port@v1.2.0/mod.ts'
// if port 3000 is available. then return or return a random port
console.log(await getFreePort(3000)) // 3000 or random port
console.log(await isFreePort(3000)) // true or false
The MIT License