{"name":"bind-easy","version":"1.1.0","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":"64bca28d3dea2d2c863bc1dd5025578dce46a939","_id":"bind-easy@1.1.0","_nodeVersion":"16.8.0","_npmVersion":"6.14.15","dist":{"integrity":"sha512-QuQU4Z6BgduH+p9Tw6wAyA5vCy1yO6R7Ac2odlNqg5uQDpRKPj7BT92aFLThF/LjoIr9N9cgSl6RsqLcU3268g==","shasum":"ad321db1af2f49cd8f6519fb3f830e64b2b48e9d","tarball":"http://registry-npm.ywwl.com/bind-easy/download/bind-easy-1.1.0.tgz","fileCount":6,"unpackedSize":10108,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh1K8NCRA9TVsSAnZWagAAjSoP/iWQffKeQRIYgtmI1f2n\n13Z1L9p6doGzEZTjTQzP/3GxHRJ0rfX23VDL8l/XGD3Y+Fo4KWAXijgsgz0O\nLPhWh0nmV/0YCMXU4gtB6XHsq5K/k65f+3IZBa6xq9/XUP5PhVZwwv3gbR7b\neqYJmNwnYkc9W6oHfYBZ+5E3sfUBi8ZlzP6/eWU5BSyLkDlyVaFQWdTETr24\n01AbrEnco0y7AEJ3kHIrdnE9OeeaI1/OjHQkwN3SNNARTkQiBXWpxLbYUy6v\nFtlS3BWWYVci0oY3dRNLpj58mB2qkiCBoKQC0TtR+g+ah514cTkMx9xEtjP5\nugIkf2j2/mDDSwTJKzQBx29MBkvKPYePJqgB3RZBtMKZQFgMBAELJaBBhQ4t\nT4IsLhNk/CRO9yg0kEFyZqOh/xf9hpqBmqshqxRnqwRRwO8yv03B/Wp2UINi\nIkwDoHNw234lNv8pRJNYSk/4AuMf6CukZ48XFBBE1tLqKCI+kFM4UJVM7qXc\n2UMdgVeU6rLjpc1+YCuO/ZrOSzNNxUqbeUsibC9CaQKb151ggINGWO4GaqBp\nrziLNfTycuf2PZy7NnZb6qbUShjXxD/mB2yzs0142pUVDy7FP/2iUQtKp5gI\nvqExHViFkMFxygU6aLtb6UEBLTYmuB9WypnkOdCQcCxyw2LdYQhtIGXJwgwS\nRdks\r\n=hs1d\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIByFh+xwTxxothVYQ13fuECwwj34b0vaJj2KVDN+Ygs7AiAYtC06PYV+90XlwCSnYzBCotIgUqrTgFousZLvjV3N+Q=="}],"size":3058,"noattachment":false,"key":"/bind-easy/-/bind-easy-1.1.0.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.1.0_1641328397349_0.5508472771385069"},"_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":1641328397541,"_cnpm_publish_time":1641328397541,"dist-tags":{"latest":"1.1.2"}}