{"name":"bind-easy","version":"1.0.2","description":"Easily create UDP sockets and TCP servers that bind to ports","main":"index.js","scripts":{"test":"standard && brittle test.js"},"dependencies":{},"devDependencies":{"brittle":"^1.3.6","standard":"^16.0.3"},"repository":{"type":"git","url":"git+https://github.com/mafintosh/bind-easy.git"},"author":{"name":"Mathias Buus","url":"@mafintosh"},"license":"MIT","bugs":{"url":"https://github.com/mafintosh/bind-easy/issues"},"homepage":"https://github.com/mafintosh/bind-easy","gitHead":"00850ee75fb68e9b769c911da0d81d903cf5dd94","_id":"bind-easy@1.0.2","_nodeVersion":"16.8.0","_npmVersion":"6.14.15","dist":{"integrity":"sha512-X2ojT4x+zrzzSOJ215eyVhZ+KhqDDE+Egs/M8Nz4ELXcwumQL7dFRxgUNDf+75qicLdm+6sXoGcTuk8lcZulhw==","shasum":"feeb19ca6c7cfaa2b84938660bb9292498b3cd6b","tarball":"http://registry-npm.ywwl.com/bind-easy/download/bind-easy-1.0.2.tgz","fileCount":6,"unpackedSize":9540,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEfKYFjabJG9VOJGSat5ah95TDV8zMNSmSCeSdsihhgHAiEA9FPXeGShSh1Vh8c0wCZR3uio5x/5Yg3lx6CpII3zFxg="}],"size":2990,"noattachment":false,"key":"/bind-easy/-/bind-easy-1.0.2.tgz"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/bind-easy_1.0.2_1633693486272_0.278930229132093"},"_hasShrinkwrap":false,"readme":"# bind-easy\n\nEasily create UDP sockets and TCP servers that bind to ports.\n\n```\nnpm install bind-easy\n```\n\n## Usage\n\n``` js\nconst bind = require('bind-easy')\n\n// bind to any port\nconst server = await bind.tcp()\n\n// try binding to a specific port, fallback to any\nconst server = await bind.tcp(8080)\n\n// try binding to a range of ports, fallback to any\nconst server = await bind.tcp([8080, 8081, 8082])\n\n// try binding to a range of ports, fallback to any\nconst server = await bind.tcp([8080, 8081, 8082])\n\n// try binding to a range of ports, fail if that cannot be done\nconst server = await bind.tcp([8080, 8081, 8082], { allowAny: false })\n\n// The same API applies for udp and dual mode\n\n// try binding to a range of UDP ports, fallback to any\nconst socket = await bind.udp([8080, 8081, 8082])\n\n// try binding to the same port for both a UDP socket and TCP server, fallback to any\nconst { server, socket } = await bind.dual(8080)\n```\n\n## API\n\n#### `server = await bind.tcp([ports], [{ allowAny }])`\n\nBind a TCP server. Pass a range of ports to try.\n\nIf none of the ports work, bind to a random free one unless allowAny is set.\nIf only one port is specified, it will try nearby ports first.\n\n#### `socket = await bind.udp(...)`\n\nSame but for a UDP socket.\n\n#### `{ server, socket } = await bind.dual(...)`\n\nSame but for both a TCP server and UDP socket binding to the same port.\n\n## License\n\nMIT\n","publish_time":1633693486384,"_cnpm_publish_time":1633693486384,"dist-tags":{"latest":"1.1.2"}}