Skip to content

imlinus/is-port-available

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

▀ █▀   █▀█ █▀█ █▀█ ▀█▀   ▄▀█ █ █ ▄▀█ ▀ █  ▄▀█ █▄▄ █  █▀█
█ ▄█   █▀▀ █▄█ █    █    █▀█ ▀▄▀ █▀█ █ █▄ █▀█ █▄█ █▄ █▄▄

Checks if port is available, otherwise suggests nearby

```
import http from 'http'
import isPortAvailable from './modules/is-port-available/source/index.js'

class Server {
  constructor () {}

  async init (port = 1337) {
    const availablePort = await isPortAvailable(port)
    http.listen(availablePort)
  }
}
```

About

Check if port is available, otherwise suggest nearby

Resources

License

Stars

Watchers

Forks