Skip to content

lxe/getports

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

getports

Build Status

Find multiple open ports to listen on. It's getport for multiple ports. Calling vanilla getport in parallel will return the same open port, requiring you to utilize the port after each callback, before calling getport again, which is what getports does.

getports(num, opts, function (err, ports) {})

getports(3, function onPorts(error, ports) {
  if (error) throw error;

  server.listen(ports[0]);
  server.listen(ports[1]);
  server.listen(ports[2]);
});
  • opts.start [optional] - first port to try
  • opts.last [optional] - last port to try

License

MIT

About

Find multiple open ports to listen on.

Resources

License

Stars

Watchers

Forks

Packages

No packages published