Socket
Socket
Sign inDemoInstall

getport

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

getport

Find an open port to listen on.


Version published
Weekly downloads
2.8K
increased by21.79%
Maintainers
1
Weekly downloads
 
Created
Source

getport

npm install getport

Find an open port to listen on.

`getport(function (e, port) {})``
var getport = require('getport')
getport(function (e, p) {
  if (e) throw e
  server.listen(p)
})

Note: getport uses a TCP client to check the ports and see if anyone has bound to them. If you do not have permission to bind to a port you may still get an error.

getport(start, function (e, port) {})
getport(5000, function (e, p) {
  if (e) throw e
  assert.equal(5000, p)
})
getport(start, end, function (e, port) {})
getport(6000, 5999, function (e, p) {
  assert.ok(e)
})

Keywords

FAQs

Package last updated on 16 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc