{"name":"quickbit-native","version":"1.1.1","description":"libquickbit JavaScript bindings for Node.js","main":"index.js","scripts":{"test":"standard && brittle test.mjs","prebuild":"prebuildify --napi","install":"node-gyp-build"},"repository":{"type":"git","url":"git+https://github.com/holepunchto/quickbit-native.git"},"author":{"name":"Kasper Isager Dalsgarð","email":"kasper@funktionel.co"},"license":"ISC","bugs":{"url":"https://github.com/holepunchto/quickbit-native/issues"},"homepage":"https://github.com/holepunchto/quickbit-native#readme","dependencies":{"b4a":"^1.6.0","napi-macros":"^2.0.0","node-gyp-build":"^4.2.3"},"devDependencies":{"brittle":"^3.1.0","prebuildify":"^5.0.1","standard":"^17.0.0"},"gitHead":"b915bc1a77c180c6613e334c09a8be2eda92b472","_id":"quickbit-native@1.1.1","_nodeVersion":"18.7.0","_npmVersion":"8.16.0","dist":{"integrity":"sha512-xoESUQv+MKl2anKhvrANyL0FSJlAoU67Hob5M+O+dkE6NxGGbSH9k67N0bursF39bl0DYvDGs8835G7JRQsukQ==","shasum":"d75a797a324b69875ed38e0ec225e4e8ede09a7c","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-1.1.1.tgz","fileCount":30,"unpackedSize":278347,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQCMZevG7BEh45howX7k8P2ZoM8AmCY1vFiQmtwWKAWmsQIhAOENhmiIopVPQ//ML4WpzVWqe4jVBDG3lw7EM5vBLz18"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjGD+mACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrGwhAAioPOFxb05BLprv0fZH713Aa4gVtIsciLE1o86HtZQuQ9rdpM\r\npk5RdW9SL6mhyul3RBtmxm5zusk+Zi+kItMIMuQaxTNs+jYJc5+eRfx1kf59\r\n0+6ZXZT6ag8EXhNnMCfuKNB3CkOTsJj6FVZWVl+vR6/iNzWdPktCfGdZTOHN\r\n/0wJ4x3g9uFN1ZPQRUZeWWJFUUKGPM9ezMHqV/oshGZ6v4zG6q2W4mVPLyMS\r\nbhvinwRO8+tYAlZ8CGHDs7IP3o6fdW5eY1TjT5hv3eHPODTuB9uW5MiflP0i\r\nywKR+Sp6UhKBw24gBfpD3Hb1b4Qw/XVMRdy/tKIhuBeHyNiF0I+fN9C89RP/\r\nt1+U2x9KioO7RGKQCuMiQltPaJtMExJs+7XAmTnSfYssFybZMqhKdI7/7dnF\r\nPWlWKn7poBwRoQhQkKZdW+QcubbqqkHSyncbfrV+gj+4nrdyd6AakMSJghll\r\nUnZM2QVXDrmJDwx38iyugrSILYtWMrhZN9x13Slt8GXIXXKg+N46B4Lekmv/\r\n+jKAbJnhuZMiRLULVAddBlhCmkY3+GKWHjW3cbs1ARp6pthKuH8tQhJ3m6ru\r\nDxl5JKIDWbpyKL/J3DcdIEzHtLIohVbm7NKOivwZGW5DBoEk0chQTtzmPXxO\r\npzDbrUFAflsolUP4d7x/OZuqZBw1udDwwYc=\r\n=c/Gt\r\n-----END PGP SIGNATURE-----\r\n","size":82469,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-1.1.1.tgz"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"directories":{},"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/quickbit-native_1.1.1_1662533541914_0.3489007315642998"},"_hasShrinkwrap":false,"readme":"# quickbit-native\n\nhttps://github.com/holepunchto/libquickbit JavaScript bindings for Node.js.\n\n```sh\nnpm install quickbit-native\n```\n\n## Usage\n\n```js\nconst { get, set, findFirst } = require('quickbit-native')\n\nconst field = Buffer.alloc(256) // 2048 bits\n\nconst changed = set(field, 1000)\n// true\n\nget(field, 1000)\n// true\n\nfindFirst(field, true)\n// 1000\n```\n\n## API\n\n#### `const b = get(field, bit)`\n\nGet the given bit, which will either be `true` (set) or `false` (unset).\n\n#### `const changed = set(field, bit[, value])`\n\nSet the given bit to `value`, which defaults to `true`. Returns `true` if the bit changed, otherwise `false`.\n\n#### `field = fill(field, value[, start[, end]])`\n\nFill the given bit range with `value`. `start` defaults to `0` and `end` defaults to the bit length of the field. Returns the modified field.\n\n#### `clear(field, chunk)`\n\nClear the bits from `field` that are set in the `{ field, offset }` chunk.\n\n#### `const i = findFirst(field, value[, position])`\n\nReturn the index of the first occurrence of `value`, or `-1` if not found. If `position` is given, return the first index that is greater than or equal to `position`.\n\n#### `const i = findLast(field, value[, position])`\n\nReturn the index of the last occurrence of `value`, or `-1` if not found. If `position` is given, return the last index that is less than or equal to `position`.\n\n### Indexing\n\n#### `const index = Index.from(fieldOrChunks)`\n\nConstruct an index of the bits in a bit field or an array of sparse `{ field, offset }` chunks.\n\n#### `const changed = index.update(bit)`\n\nUpdate the given bit in the index.\n\n#### `const position = index.skipFirst(value[, position])`\n\nSkip the first parts of the index that contain nothing but `value`. If the index contains *only* `value`, the last index of the field is returned.\n\n#### `const position = index.skipLast(value[, position])`\n\nSkip the last parts of the index that contain nothing but `value`. If the index contains *only* `value`, the first index of the field is returned.\n\n## License\n\nApache-2.0\n","publish_time":1662533542152,"_cnpm_publish_time":1662533542152,"dist-tags":{"latest":"2.4.9"}}