portly
Wait for a port to open, associate it to a process, without blocking the port
Signature
pid info
Usage
ES5:
var portly =
ES6 + ES7:
{ const pid = await return pid} try console catch e console
Options
- type 'tcp' | 'udp' - default 'tcp' - whether to look for a tcp or udp port
- pollInterval - default 200 - interval between port checks
- timeout - default Infinity - fail after given time
- detailed - default false - supplied PID if false, or full lsof info object if true
Full info object supplies the following:
{ state, command, pid, user, fd, type, device, 'size/off', node, name }
Support
Node 0.10 to Node 5 inclusive supported.
OS X and Linux only for now. We use lsof
to examine the ports
and get information about processes. PR's very welcome for Windows
support.
Thanks
- To nearForm for sponsoring