{"name":"quickbit-native","version":"1.2.0","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":"93d253405606b5f8a748bd85e38627701ccb6eaf","_id":"quickbit-native@1.2.0","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-UjVoG2t0MRhPO5y7eXAR1KktymOHaIzyGPfFTXVYfJ1ksZJdTDYf/RX+RZAN/VsqKQwVL87xps8omx7OUDZ+Ww==","shasum":"6cf72470985eee7108757d408abd341fff7ef4a4","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-1.2.0.tgz","fileCount":31,"unpackedSize":302644,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICU1Zs/k8a8PSxp+QEXy4aun7h+FnOSGUECkC3R33S5gAiBT90K/aV8xkQH2Akjd/ietkhx/6UKB2PQjBRUBaD9LDg=="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjJDdIACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpDxw/+IqT6MXo01Aj85A9oX4UXVZfMhDdznYHGSWJPvuUO0gsE+Ztk\r\nNF1zmgFpVmR7ACg+uy9iDvyWW8FbNt8KSs/B/7A+UbGogQvflc0sA3zHPNht\r\nwnwVZMOsA+xZdXkSDaxlIzO5QkEAisttGmqXS0VuR4vA5sjM/+vMe+o2wFpc\r\nHdbuYNEgpsZQouqeqbzbEYBEOeb+FLC8wgxNv/bvA/MfcSfRrx7LkDk46hN4\r\nLSHqFxp673Ef5z487FgYb0MDi5m+HrZVlcxQE2aJ/G19XIYzvy1Puu4e3gl5\r\nxcMHopzZRtwf6oZ1r0lpn+4d1rCrUdM4V3ixAnqd8yiEMIJHCqilm9tlETSa\r\nvmyMZKl64CrZemT5vFBwQo7wD3wmrDvsYs7tlYw9UxXcx+eJYnOq59c2jTrR\r\niX0NWrcoPlzMlM1tUonIv+qeenGq92mPCBB4UIHOov/pumzORjzZTZOrQKd+\r\nHdVc/ta+t67gf4Ao48TPBOHwayaixt4LvcmjB8jE31iTa143BUszGP4/dtGN\r\nXbS42ODtx6JvNyo9pVAxns7BC+6tbv1yM/Cs09Xl880mpN6C+RVAgXVxKqJs\r\ns/necgIQ1T2bNuP9DRxADQ3zo6qpK8JHaTV4IWNgfb5nJ189VciVgzF5z68i\r\nM34HwX2WVr+WgcFAINw04XzQCd5UTfGzefc=\r\n=RXBJ\r\n-----END PGP SIGNATURE-----\r\n","size":89272,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-1.2.0.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.0_1663317832216_0.30991328312033484"},"_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":1663317832416,"_cnpm_publish_time":1663317832416,"dist-tags":{"latest":"2.4.9"}}