{"name":"quickbit-native","version":"1.3.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":"37b863bb7cfa86307fc4951416fc562f925d670f","_id":"quickbit-native@1.3.0","_nodeVersion":"18.9.0","_npmVersion":"8.19.1","dist":{"integrity":"sha512-NIr2BlX9XVXsJBGrchndJnHJog2qECncdevYs4wmAGJSphhMepdcQ3CExk4quq9w2mT//vRzSpgwlGn4t/+UAA==","shasum":"b8c61c217769d4bc4707f70eae55927463b54e62","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-1.3.0.tgz","fileCount":31,"unpackedSize":303772,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDatPrsdbZrlGM5fJPHaW2Dpp3/os04Kb4Mx3HlZXzxuAIhANfDK1mIARKemgb9pMYPrM42vmy8UbAhK9W92UmLCCS7"}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjLEGHACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmoaog//cV55JOFpyVdIrxW7G7CJCkYeqfXuk2IhKzjPrM9zIDG9cBB9\r\nGx0b4GQIeNpZ8V/8m/wG0NWBazQt2E2A+TSrlu4e8XXngnMixO9hD7qA+PVk\r\ngRVkZceN3HmT4/h7omoada63iDXa5j5OHLev/iZtH7Lhy39k2UcG8s+gEq69\r\nXCS4GQyVep//IbRjdwQqPuLx08Bl4Se6DENSQNQ/iB2py/4oxDVB/Im2AWDs\r\n85UPwclNls93/OYfUrIiOi3KSNe7pVSgY3v8b+kCb9DpfTZKF9MFOLfiqHRP\r\nxt30p5lmEyDUhYdeAyrnM5DTDR5w6HaAydXbbZ4Bwc9Ab4jiojj69O8SIkvs\r\njdk3R4QZsUXDTEETFgxPHfUfWFopdQDcn3Jz3HHMlE2hy1ryY6A8jQyXMCF7\r\neNXf40CmeCOBvAc2NrIy9xSXpxM00r7nKYBfZX8P1wOGaH2pO3VSKWm+Rrey\r\nThzMRLisn6Z1tU7rtWOo5d5n5ylYz3VerKKmSSTf1TSxPdMG16C9o+o1jJ5U\r\nBUCysVo2IZT0uIEI6/jWBOAdQH8XnbXPNmIBOSgzeU394FL4mNvV49wT6V0J\r\nlxdADxM23vD6gxnwbVlcXt4YGgxED3xfOsbJyHf+QyNa9CAKnEaQc46UbJIY\r\nIxmh2Kguoy9s/jEcrUBz/sxELgeKVEbjbpk=\r\n=l23g\r\n-----END PGP SIGNATURE-----\r\n","size":89791,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-1.3.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.3.0_1663844743643_0.6016620905689232"},"_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":1663844743807,"_cnpm_publish_time":1663844743807,"dist-tags":{"latest":"2.4.9"}}