{"name":"quickbit-native","version":"1.0.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":"cd6f9cb8976c7425d1831c01bb0db3b0993bb0ac","_id":"quickbit-native@1.0.1","_nodeVersion":"18.7.0","_npmVersion":"8.16.0","dist":{"integrity":"sha512-Ke22khw9moKTAXT9R4cNQLNeYNqODXYWpOBCPHMWH1yyIF+8NO/smFnub6Gjsh7nmV+GqVm5qF0WTwod+L/doQ==","shasum":"6df3ee252e3f7f6cc7ff899d788a9d14da92689f","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-1.0.1.tgz","fileCount":30,"unpackedSize":275489,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDTmyceZmd2AS1/Rc8Rqx7zX2aj11PtSgpjQvdHLtSJ+QIgG3WULISE/3mISD5c5UmZ9e4caCstfpEb20UpAsGDwEE="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjFjZEACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmqvsg/+JcSIN8avlW2OGw1Tq+s5APA08igh7d5bfdwILo8yB6bH4d+c\r\n1AYpPdQd3CC5HVJJ+BOEhFHcnV9/OvleE16xA+xxyEy9Q3igpEAw/ok1bDxT\r\nC7YO6sz4YfvomSLo4uOAQaODR0WABhyKxrHAMaHFyJweWl1IqVJ47nOSPPU9\r\n4kGGoKIptBGmQUYddLIRGCuRarucoftIi17hU60KSbiHJuXJ830MXlD2blFG\r\n93mgiY77+ZddRgRWJVrcrGnjeiZ6/YjukvGzB389EnGfz5R0mes8w64C/ElW\r\nA8x/chWtnu4g3+eJNxewPVfyy/1B4rPPdrWQ9nXCWcEcG+0W9JjTzJaVIeHE\r\nc2K9ltT6FZLW1SygR2ZJPCEwZRDQnh9nf7OTVwQYlWzf7fMEKhFo2PUbDOEu\r\nFsM+XMZuN2h/jhEw4UP/PsSlTDd8S3UTuwUsppRZLIYQGu8jT6hBIbxF+5GC\r\n4pfxq6Qx001OtbDGaomfShNBSNIf2OLUgwtfxxCoFEEBWH5ycP7x55KElRtx\r\nUezOdX4zseMwnTd1hkUiD28VS/NMjK6pbhbUmTP52jJKaGCz050sZPF+ZGp/\r\ndnEg4pRb1bFQ7/afqd5lJT7OTDzW8sCZG1r0nrXhOq+ihClYvxgTXyOAXyBm\r\nTxD2t0lqbbQNWtFds+i/94VwmGjNnhBLv8k=\r\n=SQUp\r\n-----END PGP SIGNATURE-----\r\n","size":80417,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-1.0.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.0.1_1662400068057_0.177751088230099"},"_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":1662400068266,"_cnpm_publish_time":1662400068266,"dist-tags":{"latest":"2.4.9"}}