{"name":"bind-easy","version":"1.1.1","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":"b81c27b628cf834c4c72e077bb69966262e0c1a3","_id":"bind-easy@1.1.1","_nodeVersion":"16.13.2","_npmVersion":"8.1.2","dist":{"integrity":"sha512-kcApIimoMJQZjhOnhYb8EKzDskuajKpp993y9lCzJuCcG1is9jiZ/gvA9NJ6Uey8Lyww8KOM9ViSBVT0Zr67Ug==","shasum":"9c82cec5547744b1bbc3fd25b0055bcbddcdb483","tarball":"http://registry-npm.ywwl.com/bind-easy/download/bind-easy-1.1.1.tgz","fileCount":6,"unpackedSize":10186,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh+QrcCRA9TVsSAnZWagAAHuQP/0cvyIQue0S6dQZEiFyY\nIJglg4f4UhQrce54tPE/ayG9z7FehbMjBin7MKBI3/MK9OH+0oFCdIxy1g17\niyNhpgzVkxPa2keG3OCq0hyxVkMkzEa7wXtxWGzKnLWrFwtUVQsoFDvMC5tF\nwV7YVmhnT6pOWeORiHw9LHX1yptrPkX+kMKIBEsVkUdfp8teOPFmH34u5KoD\nLfucJR9XsrKOL2HQuNb07VX0zzxms6YG+WxE62Vr18KeAtXgvIEQ6ZAjWpN/\n46D4Tt9qpFp94n2ULoEFBonbk8fIMFx2Q5BpJkWldw8l4lKnuzTeXTK0l6it\n9YKwiIBxsX8YG1VUxOSggN81M4ldv01ERyBycB8sDMpks0hPIbhwVMV8Jq09\naPdirKn8/wBuKwKzNYBZ7X6rQBH8CUwirCwlWVhB1uzk9VIto88npdoBzzMG\njKwDmYuMWBoHvql9L+oNZ5T9Jdd3nPJUmyOYD5jiAAmgzfHHbFxFoY3VtFIc\nrLLJ2L8Dheqsp7tkSu5v11a++rRgUsmuwfxfSU4zbCQQwsdpBxIqhLmdJxg0\n8nwBv4Ayys5iCgc+m6tx+BR+Zx6srtrVG+PR56MwVKgmwKZa1nSVguCQuo7m\niX7QB23MUzFmk0O81olLvYzg2eK449Dq9GLKHmTHUS6k+mwuxgauF//MyWkA\n9phc\r\n=ehAB\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCzo+HoEqZF7EG2H9NzHv/Mr/QArAGOkO9vWiAciEZsDgIhAONXrrohw0SOg46n8hL4/UJ7QbmxNx3X3c2sFWxHY3V9"}],"size":3054,"noattachment":false,"key":"/bind-easy/-/bind-easy-1.1.1.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.1_1643711196710_0.2576699423343969"},"_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":1643711196861,"_cnpm_publish_time":1643711196861,"dist-tags":{"latest":"1.1.2"}}