{"_id":"k-bucket-sync","_rev":"4-bd3dbbcd2fd8718eba3c9e0a6bb6503a","name":"k-bucket-sync","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"k-bucket-sync","description":"Synchronous and efficient implementation of k-bucket from Kademlia DHT","keywords":["k-bucket","kademlia","dht"],"version":"0.1.0","homepage":"https://github.com/nazar-pc/k-bucket-sync","author":{"name":"Nazar Mokrynskyi","email":"nazar@mokrynskyi.com"},"repository":{"type":"git","url":"git://github.com/nazar-pc/k-bucket-sync.git"},"license":"0BSD","main":"src/index.js","files":["src"],"scripts":{"test":"tape tests/**/*.js"},"dependencies":{"array-map-set":"^1.0.1"},"devDependencies":{"build-gc":"^0.1.1","tape":"^4.9.0"},"gitHead":"8903432f8774c86942d642a78b6ace7dab50373a","bugs":{"url":"https://github.com/nazar-pc/k-bucket-sync/issues"},"_id":"k-bucket-sync@0.1.0","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"nazar-pc","email":"nazar@mokrynskyi.com"},"dist":{"integrity":"sha512-elwxN/YoUU9+lp02XW56bFzcTIMvr+nXSE0vK39SgmAqoTPbrQe90Z4jQ4t2p1A2QhLtWg+QvE48+rTo9+BLWw==","shasum":"9e089ea55462b74deea34064be27cd0642eb7538","tarball":"https://registry.npmjs.org/k-bucket-sync/-/k-bucket-sync-0.1.0.tgz","fileCount":6,"unpackedSize":15576,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8B1BCRA9TVsSAnZWagAA1lAQAJFj69AogQCUfUXTaZh/\nEyBqqHGNcReP9uOfb2XcZzhDNJksXKsuJFxrrUu6aarP01lys2waN2eObNNX\n1x3o0B35FP9v2MbolgaPBAfYBgl4aT0kh/S7tYXkcIILkA69T6Mm5CDgUvew\n0SJdDQp/sjRPtKsodYczdtEkbXHkWn9xUXA258pveqnxjKLp43rW3Vs64uDj\nZOzbLr3/vX3QE96NRvCMQtpar9XDJCnGVwyHJ4id9mPNRDIy2pyVrSTqYcY+\ntvJtJ73FDN3gq2dei8TQIwIBma48afkkTkCecvu0U21njjGTRVJf1yqaV10L\nUkOa2yAXmJO7AV4g7Is8AsSz7GS2yyOTrU1TEZc9836SaFVmbMKYxn8y9mbi\nVrj3Zzx2kSG9PWG80UEUka3NbIZQaqEWCKds7dVd5zi1PmQCWSYX4mFkPWmI\nzU4xB+ZPFQ0nQ2Ny4SPl7bLdYiLHlm9f+P6gD0Rrgw+ilV8iDazsy75Exhfp\nUxW3Pxu2hbeNyr8cKo9F3BBX5Om9YoRs0tpCOp6Qlf0vUHXWP4nzL0ZgVpHz\nHi8JQAe12OELPpSHOkLPWxz/w5yAlLlYzcp1NheeLOZRQgSv/oR5WwWYcCLt\ng4pmiUYC1tkLhQfMnqNwGEs76ZwoazYXrGuOAooPBpit/9P8DfP782uBW5Cb\n/FMY\r\n=XLv4\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCOIsbDoKJDJ5gVMCtespnNgLVXU2uT3NzBe+Yr0h2cZgIhAN7Bk97ZZbw3gvw4XhIaBzS4HwnM9FhoWbacjjVPUraw"}]},"maintainers":[{"name":"nazar-pc","email":"nazar@mokrynskyi.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/k-bucket-sync_0.1.0_1525685568811_0.665469522462171"},"_hasShrinkwrap":false},"0.1.1":{"name":"k-bucket-sync","description":"Synchronous and efficient implementation of k-bucket from Kademlia DHT","keywords":["k-bucket","kademlia","dht"],"version":"0.1.1","homepage":"https://github.com/nazar-pc/k-bucket-sync","author":{"name":"Nazar Mokrynskyi","email":"nazar@mokrynskyi.com"},"repository":{"type":"git","url":"git://github.com/nazar-pc/k-bucket-sync.git"},"license":"0BSD","main":"src/index.js","files":["src"],"scripts":{"test":"tape tests/**/*.js"},"dependencies":{"array-map-set":"^1.0.1"},"devDependencies":{"build-gc":"^0.1.1","tape":"^4.9.0"},"gitHead":"6d39116a1c703bc8d06cced7d6ada94bf0f61c57","bugs":{"url":"https://github.com/nazar-pc/k-bucket-sync/issues"},"_id":"k-bucket-sync@0.1.1","_npmVersion":"5.6.0","_nodeVersion":"10.0.0","_npmUser":{"name":"nazar-pc","email":"nazar@mokrynskyi.com"},"dist":{"integrity":"sha512-jRGrcPHqcoyiBLI5+GngiysGEn+q0IOhr78AjumOgJE/I946aBzwU8ZCoWJGNMixMCx+s7BZCp6j3LDhSJiv6A==","shasum":"07fc456380d7272cd50909cb84c3f948e4df6617","tarball":"https://registry.npmjs.org/k-bucket-sync/-/k-bucket-sync-0.1.1.tgz","fileCount":6,"unpackedSize":16184,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa8B5WCRA9TVsSAnZWagAAu5oQAImGqkGPfYuBu+uyCwfl\nLy4F192TsjZUYpvwPCA+JGvGDU57/ZjU0wn1DlMQchzX56HACFJXmqn99cLF\nYP7QU9oo1arBk71dyLLqqL4o2FvZ8GNaLT0QaneG9HLFsOO3UY4kz7vxgkt2\nHg+ZW6ell/eGSWXgW6PJ1zCSXSGnWSUxTrn3fG/i3lRKw6pAG1jSTIRDjwOs\n5g/yFhSaMqGkEVWqrA32chptXHF+ppyj34KAIWZeIvFu+LCGQ3LdocmMAMGt\n+HM8Z2SOb8gXoEqyqy3IPx6RV+PZbK8wiZ9IaFrk4cz3BpbDRnQGTYR3HTvJ\nEmbvUDWvdXk13nLYDfQBA0cnpuEP+mRXd3k8qIc30Cjkemluxnkc6V+HvC9Q\naJNJrRPTL2vmybtd/ClJ18ADJV+U3DLrX+VbI9mF45ZQZ83SakQjfIerKqVU\nH95JhDE4cbMNNZ22hbxgIk1opAWuM5lSoobBZ54idxQZ66SlkLhWXgz5Xi89\nm5i6OGtjW0h4DX6MrzvDZIn48uAp7Z37NWyglaqaO0EJk0b/3yeJhX4RARVA\nDjPspTF91qByITonL801pmn+F8MPxK4jKYaSvY4ouishxDCWlrNcH0yJ8oFh\nbLAQIYWLOw2G3jh/NzaXRIugY3uI56wxT0D1J3OHEoX8DzQNRZSRSU0f3nq/\nQE/r\r\n=tMwA\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDj3ESvGQMysHGPZriBCFap8yRZz+i0L4u46vbpHaUoOAIhAINrctfojztiNBswZ1aWiMRmIocUI/ULjtiU4rv31Laq"}]},"maintainers":[{"name":"nazar-pc","email":"nazar@mokrynskyi.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/k-bucket-sync_0.1.1_1525685846222_0.46511134076149374"},"_hasShrinkwrap":false},"0.1.2":{"name":"k-bucket-sync","description":"Synchronous and efficient implementation of k-bucket from Kademlia DHT","keywords":["k-bucket","kademlia","dht"],"version":"0.1.2","homepage":"https://github.com/nazar-pc/k-bucket-sync","author":{"name":"Nazar Mokrynskyi","email":"nazar@mokrynskyi.com"},"repository":{"type":"git","url":"git://github.com/nazar-pc/k-bucket-sync.git"},"license":"0BSD","main":"src/index.js","files":["src"],"scripts":{"test":"tape tests/**/*.js"},"dependencies":{"array-map-set":"^1.0.1"},"devDependencies":{"build-gc":"^0.1.1","tape":"^4.9.0"},"gitHead":"0d351187d3f9b52eab3c7c0853c0d3b10ea919cc","bugs":{"url":"https://github.com/nazar-pc/k-bucket-sync/issues"},"_id":"k-bucket-sync@0.1.2","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"nazar-pc","email":"nazar@mokrynskyi.com"},"dist":{"integrity":"sha512-2a64XlvW16bEevXOdm2VhnWHgTt5LN8jhxDPH/h2jDVujTJ/IH8ZwOp1ZA7S1ijBPxFHTwvZh1wf/nkxEBcnLg==","shasum":"818adb4019d9042318400a3848217717c459dda1","tarball":"https://registry.npmjs.org/k-bucket-sync/-/k-bucket-sync-0.1.2.tgz","fileCount":6,"unpackedSize":18125,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9S5MCRA9TVsSAnZWagAAj/0P/0rPpJ6Eo2XG1+gAWEse\nPoAY4OMpcwAra1SBVdT4vyLt7gRwLLZlbEFZieX1RW8Zc6IzQLHeQ1CE71Tv\nfDal6LvTKit40CgQ+MP6EpBCgWIg7wffO8qdXnd29d+ju20KKuAISmnb6Z8r\nJfWM1oJtiOc7oY+U5C5CRbcwH6smj+Yc1SjSOgRfnxOd6b33jx2kstqHQCRz\n4CDf9rfjLWzm/tl6mfTjxdqLYm4nSHn6MXW6ZeeEWemk655NJpsvgTKwwljd\nKzJLNumyVrSv67MgpGtIHI4vgOq8cQnYioORx6aRC6jXzal1UVNuJ6ZLoQvV\npzA3FpyY29V67IrZbIhBt4abHUxUv7k9CAVw0T3fSwOMKL4KFXgfVfiBz7VM\nIxxGH3NdB8yXL90tapjBaFDZv29PKUZnH/kTuSU8M+l9jAYjSdvlay2C4vB2\nFYrjj35xFE9mdYpzOjpDJQzghDWkPZnIwbZO5szC+irlMIG9iEYNV22Hi3Sp\nvxUnjvDugRTn+Lhf3s0cBbCqY8UUV1P8OhS4wk2MCmPD5aKLrLUCr7NMnTZ3\nHOfbFNOwPR4Kxhd6bEIkbqLz5qaSwKvDbEPPyNeWwZJWZewPaKrDNNTbReOO\nlotJbd8N+M0+drxc6z1j8Qx2IXD6gd8o/0VEYa6DNPxen7Udm4JO28wQMT+e\nkAj5\r\n=UI2d\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDmrWjKhho52BQwNeWwGE/jc4YZVcNBjwqlSeQr23H5OAIgUG5ModWh0wIJ8yMnafgRKRhS8c224+qdFk+tlBnkXWo="}]},"maintainers":[{"name":"nazar-pc","email":"nazar@mokrynskyi.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/k-bucket-sync_0.1.2_1526017611539_0.5219596421699453"},"_hasShrinkwrap":false},"0.1.3":{"name":"k-bucket-sync","description":"Synchronous and efficient implementation of k-bucket from Kademlia DHT","keywords":["k-bucket","kademlia","dht"],"version":"0.1.3","homepage":"https://github.com/nazar-pc/k-bucket-sync","author":{"name":"Nazar Mokrynskyi","email":"nazar@mokrynskyi.com"},"repository":{"type":"git","url":"git://github.com/nazar-pc/k-bucket-sync.git"},"license":"0BSD","main":"src/index.js","files":["src"],"scripts":{"test":"tape tests/**/*.js"},"dependencies":{"array-map-set":"^1.0.1"},"devDependencies":{"build-gc":"^0.1.1","tape":"^4.9.0"},"gitHead":"f200a4f3a77382ede04b7333430a2e662584fa97","bugs":{"url":"https://github.com/nazar-pc/k-bucket-sync/issues"},"_id":"k-bucket-sync@0.1.3","_npmVersion":"5.6.0","_nodeVersion":"10.1.0","_npmUser":{"name":"nazar-pc","email":"nazar@mokrynskyi.com"},"dist":{"integrity":"sha512-vNZbyqY6ZYubFLE6YWaVMDEfX0/ROa0bHDstvhixnGUwe+cQs04Gxn+9vUZyWsBJ/S0/ybaGeysvId4mxpgj8w==","shasum":"d75b59e4c1e2c6c32dd62c042c9c26aa1db84ccc","tarball":"https://registry.npmjs.org/k-bucket-sync/-/k-bucket-sync-0.1.3.tgz","fileCount":6,"unpackedSize":18653,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJa9X2dCRA9TVsSAnZWagAAQksP/j4YkamOXmgowOS1j+c6\nHY5gkR4hUlX2c2olvv4TbrbrO76uITmm+tzNPHBYSAqteIgNqaJJNZ5z7vzR\nSRLp39olpvwAgiKlf2IHdj8qDPn6+gObW1PqaD/W7MNAOq6fZDomzrEL7LBq\n4TOTaBI6KaP4aXgxC9k5j0COaUPvGxVajySaa3bSbFCKBclbBJRPG6iHvh5p\n/Hwji9GCH/Jne0Ke4kii1QMeLf55VWXxc69kK2GXMKD8laf3dSfyryTDawgt\n7tlosQxzHlOytPDtUYV65FB6TrW87P7pRbuNDGK+UtCjPtANDlQbfoJb+/qk\nJhPZz/G82Zm/kHXqccINndWZZ930JFor9JIJ2qEjbyi9C/JbR0lqjkKMr4bn\nVMx6zLoe/aWkRu7n4JbrKLgnXzo99NgQ2+XzH7sPprwT47p/+/SR014VYQsp\nKy3pWyyUQfgFuc3PEdNxvp3tToQemLT3glNZwH6wM66sFiCHPGxQVOdDQUUX\ndJbYIrW1T+cX+EeYrMmeqI20eHulvO97GcfQWyczCSCO0ZYKUifpD9vCqP+2\nowFywzS5jYyih4cmrV7i+0f+PqSIHtc42NioJCiQ+aIsdhiJwG84QdDQgY5U\n4DEyYPiFl4g3Lwk4hN0NxYGFZelkiN5SM4oxIOtEHSzUeyhnshWrNz0vN1qK\nOWqL\r\n=znL8\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEKfrS6xUqugpB/2AdJUuvVw7UBOGyHKaki6/xY0RKpCAiBtjZENkGTkAqi7qJvuzM7xmHr1kyTtV1/Hfcnh1aY5Sg=="}]},"maintainers":[{"name":"nazar-pc","email":"nazar@mokrynskyi.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/k-bucket-sync_0.1.3_1526037916870_0.048539564121418355"},"_hasShrinkwrap":false}},"time":{"created":"2018-05-07T09:32:48.811Z","0.1.0":"2018-05-07T09:32:48.906Z","modified":"2022-05-07T02:34:03.344Z","0.1.1":"2018-05-07T09:37:26.325Z","0.1.2":"2018-05-11T05:46:51.615Z","0.1.3":"2018-05-11T11:25:16.956Z"},"maintainers":[{"name":"nazar-pc","email":"nazar@mokrynskyi.com"}],"description":"Synchronous and efficient implementation of k-bucket from Kademlia DHT","homepage":"https://github.com/nazar-pc/k-bucket-sync","keywords":["k-bucket","kademlia","dht"],"repository":{"type":"git","url":"git://github.com/nazar-pc/k-bucket-sync.git"},"author":{"name":"Nazar Mokrynskyi","email":"nazar@mokrynskyi.com"},"bugs":{"url":"https://github.com/nazar-pc/k-bucket-sync/issues"},"license":"0BSD","readme":"# k-bucket-sync [![Travis CI](https://img.shields.io/travis/nazar-pc/k-bucket-sync/master.svg?label=Travis%20CI)](https://travis-ci.org/nazar-pc/k-bucket-sync)\nSynchronous and efficient implementation of k-bucket from Kademlia DHT.\n\nSimplified, synchronous, arguably more efficient implementation based on https://github.com/tristanls/k-bucket and https://github.com/PolkaJS/dht-bucket.\n\nTests were taken from https://github.com/tristanls/k-bucket/tree/master/test (Copyright (c) Tristan Slominski, MIT License) and modified according to new API.\n\n## How to install\n```\nnpm install k-bucket-sync\n```\n\n## How to use\nNode.js:\n```javascript\nvar k_bucket_sync = require('k-bucket-sync')\n\n// Do stuff\n```\nBrowser:\n```javascript\nrequirejs(['k-bucket-sync'], function (k_bucket_sync) {\n    // Do stuff\n})\n```\n\n## API\n### k_bucket_sync(id : ArrayBufferView, bucket_size : number) : k_bucket_sync\nConstructor, creates k-bucket for specified local ID and bucket size (from Kademlia design).\n\n### k_bucket_sync.set(id : ArrayBufferView, data = null, on_full = null : Function) : boolean\nAdd new node with specified ID and associated data or move node to the most recently used and update data if node already exists.\n\nReturns `true` if succeeded, and `false` if there is no more space in the bucket (in this case optional `on_full` callback will be called with an array of node IDs in that bucket).\n\n### k_bucket_sync.get_all() : Array\nGet an array IDs of all of the nodes previously added in the same order as they appear in buckets tree.\n\n### k_bucket_sync.get_data(id : ArrayBufferView) : *\nGet associated data for previously added node.\n\n### k_bucket_sync.has(id : ArrayBufferView) : boolean\nCheck whether `id` node exists in k-bucket.\n\n### k_bucket_sync.del(id : ArrayBufferView)\nDelete previously added node.\n\n### k_bucket_sync.count() : number\nGet total number of nodes previously added.\n\n### k_bucket_sync.closest(id : ArrayBufferView, number = Infinity : number) : ArrayBufferView[]\nGet `number` IDs of nodes closest to `id`.\n\n## Contribution\nFeel free to create issues and send pull requests (for big changes create an issue first and link it from the PR), they are highly appreciated!\n\nWhen reading LiveScript code make sure to configure 1 tab to be 4 spaces (GitHub uses 8 by default), otherwise code might be hard to read.\n\n## License\nFree Public License 1.0.0 / Zero Clause BSD License\n\nhttps://opensource.org/licenses/FPL-1.0.0\n\nhttps://tldrlegal.com/license/bsd-0-clause-license\n","readmeFilename":"readme.md"}