Find processes occupying a given port
lsof -i :<port>for unix, darwin and win32 alike
Grab it from npm
npm install --save lsofi
// given 1337 is occupied and 1338 is not
const lsofi = require('lsofi')
const occupied = await lsofi(1337)
const free = await lsofi(1338)
console.log(occupied, free)
// => console.log(9834, null)- krampus - Kill processes occupying a given port
lsofi is built by marionebl and contributors. It is released unter the MIT license.