portreserver

1.0.1 • Public • Published

portreserver

Install

npm install portreserver

Usage

Include it

var reserve = require("portreserver")

Reserve one ports starting from 8000

reserve(8000, function( a ){
  console.log("Reserved port %d", a)
  // Reserved port 8000
})

Reserve two ports starting from 8000

reserve(8000, 2, function( a, b ){
  console.log("Reserved ports %d and %d", a, b)
  // Reserved ports 8000 and 8001
})

Reserve multiple ports in one go

reserve.multiple([[3000, 3], [35729]], function( as, bs ){
  console.log("Reserved multiple ports %s and %s", as, bs)
  // Reserved multiple ports 3000,3001,3002 and 35729
})

For convenience, the machine's local IP address is accessible as a property:

console.log("IP: %s", reserve.IP)

Licence

MIT

Package Sidebar

Install

npm i portreserver

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • tunderdomb