{"name":"bind-easy","version":"1.1.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":"09798f071ff647c78fab0349ac63555a6ace289b","_id":"bind-easy@1.1.2","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-2+VjZ87WFdOFnsH4tHnmtf0HF6D2T3ZNdU1t1FYIz2jt4N3tyqbg2J0bYbflXdBkVi3xfVc8Pm8NB062SPvVVA==","shasum":"d10f9be896e53fb84f49465be5b1ab9b089dbcff","tarball":"http://registry-npm.ywwl.com/bind-easy/download/bind-easy-1.1.2.tgz","fileCount":6,"unpackedSize":10249,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+Tr0CRA9TVsSAnZWagAAfmIP/jeWR9QnGCVd9X4eiBef\n2957u0x6xMtcikKKX47gAGbuGDOc+SuYU21amsqjhOsVrMTJqUqkMJSbuKqz\nU/K/hD9wfii6e/yWLvLLNdMc0z3diL7HVIBy4zPkftVEzJzPgxrAO/KgxB5T\n9+Ec5XB+KB/diFhTioM0KuDP3XjeGzs/XL31vaIkc9Ik6A0tGBoAvZ7ueV5b\nU+P85k0CZYWtKYDYT+X27JaffuNioCSY1imL2PSFC8bLyPu+aCbGDAcF7NCT\nIxMrliwuDruunN0pCWMfHPxEzGl/O2CY7NqORvNsy9gchwDKfbuQXQlHJbzB\nGEjl2aweHsx1Xp2qWTWooCmhx0jMCH4ygx9ulD9/+XHbKNEgjTxJYIaqry5Q\njuhdwxR7JJbtKPFnSMBXTSwH7U014c5SMUwKQDhWNTLVFLYc7hWezGZfm+28\n2xURKuNoJYG8HNEFGWDtvxayjtEii3lcHKhG13uQwdGNSmEQZz+WwmFUlyjE\nX3MZy8GR+N5yVh3w2cW7JNkNYEOy+J6raXKjlDSCNPJ7WT6vnuDEqIaW7937\nrLd88Kw0hR8s/LctK8J2rqMoAm0tKPClE+QhxxYxWZsZZQDKGfSzGzkw4I9w\ndSdIcGTWglB0T8FJALFt1/LDzNveXrkoqZKor1lvGQZuKYsmkof/0V0dgLVt\nvTrM\r\n=bthX\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCqGyGttwT9b/0T5N6AY8unN0C7KSi54Cp/F0dMdRmXfAIhAIQP4eI0s/KgIk7/fYffHoIQP15+PoKlSjMI77Gk4YlS"}],"size":3059,"noattachment":false,"key":"/bind-easy/-/bind-easy-1.1.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.1.2_1643723508312_0.8736501210108771"},"_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":1643723508439,"_cnpm_publish_time":1643723508439,"dist-tags":{"latest":"1.1.2"}}