Skip to main content
Deno 2 is finally here 🎉️
Learn more

Build Status

get free port for Deno

// 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

License

The MIT License