{"name":"quickbit-native","version":"1.2.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":"2779d73ca21e281e2484c5600ac00830628ec0a4","_id":"quickbit-native@1.2.1","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-f7hwqJ4UxHssSeKbjZJirNiUZqWyEpFahxFAQSMbsdOSWoONR0h8jOB12m5lkukG5/xkb75SClZ1GVStmv0FqQ==","shasum":"96fd62e28fcc82e7e3ca85fd3185fb9575946138","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-1.2.1.tgz","fileCount":31,"unpackedSize":302664,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICQJ7C7CKn4uVyCofZIehvYXwvpihL2OkHcxLm78irPLAiEAkImT8rVz3k62welxmfIdXi4Abxeve186kwNXCzDOP4U="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjJERyACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmr8ng//fn+dH3RZdKNfL/Psl/4+W3fHv1K5cYLdT1iouW7pHobzZSmP\r\nrCR0I5vF24fBwdG12mrzObtRf8vIew0jyzqRiMtaPZVBWmSxYKyTPqnQsj+j\r\niAWfvPclrsX8crj6/iV2EMmf88YkaZnF5qvnfd/hbtmveDykd87ING2YkAeg\r\n99xSjdk5SpZAttKL4EtNLkZrxBrCEVSZ843/hIoHEauioVzf9CR7D/zh4NWP\r\n0ns4sQsiC/NXy+k1RYrLpOMEccieozuaW2ARaROol+aOaQ1Aw7eQ/hfeHTty\r\nrUx1cgPUwdyQLN+88E49xSi02s+oXEKTFgyzDeUIU3R7ywdABkdwWLwMPM+V\r\nWl1URri+yw6iugq7VFqC1a6Itvum2sEaktIIIGgIN4pCGKfMoJUgU59vi7V3\r\ngWNDZvH02GLOoNz6p+Zzc+aOX63eJxyikLeZR+c2LKFv0kTrDJFiV4dxhfwv\r\nGB4a/mATUVIF5moruaJdPtskKzQWXvGrWknbpZFaICwZzntbOOSgzdsyLmrU\r\noL0s+j6SooIIy3fq1wWy2zywrxylJ+dlIWauWGgYB65IQX+Dn+GjblEczHnZ\r\nQR49upZHFG25xoDSMh/TN9iBA3IWDWE9o8PZDLn9vzv8QRaH74vnUiE3ozlf\r\nJZxyO+qVw1b3O6pJEpyHXXx9huexTW718uA=\r\n=teS7\r\n-----END PGP SIGNATURE-----\r\n","size":89377,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-1.2.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.2.1_1663321201855_0.7423762667449256"},"_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":1663321202343,"_cnpm_publish_time":1663321202343,"dist-tags":{"latest":"2.4.9"}}