{"name":"quickbit-native","version":"2.4.4","author":{"name":"Holepunch"},"license":"Apache-2.0","_id":"quickbit-native@2.4.4","maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"},{"name":"kasperisager","email":"kasperisager@hey.com"}],"homepage":"https://github.com/holepunchto/quickbit-native#readme","bugs":{"url":"https://github.com/holepunchto/quickbit-native/issues"},"dist":{"shasum":"c14396102f47bac6725fe1a4d7d9381a56d67dd1","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-2.4.4.tgz","fileCount":29,"integrity":"sha512-1f2h2v1cvowLIaSNKKT6vM3v2GSHV24jgXo7BWYEdBFR8KVXirWrngXedyexLvJt825uV2fNcd7eULuqd3J0CA==","signatures":[{"sig":"MEUCIQDXkWlPS25jRsKzEGCsMwu9o4GKQg7XoRv8+wcqq2tVYwIgGUq6m2QuF3UNtrkJTV8A7QrLo3cIaK3RV5z+VmH8yBA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":2000562,"size":669806,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-2.4.4.tgz"},"main":"index.js","addon":true,"gitHead":"289bccba6bc13e58e5456f775968b72258b05693","scripts":{"lint":"prettier . --check","test":"npm run lint && npm run test:bare && npm run test:node","test:bare":"bare test.mjs","test:node":"node test.mjs"},"_npmUser":{"name":"kasperisager","email":"kasperisager@hey.com"},"repository":{"url":"git+https://github.com/holepunchto/quickbit-native.git","type":"git"},"_npmVersion":"10.9.2","description":"libquickbit JavaScript bindings for Node.js","directories":{},"_nodeVersion":"23.11.0","dependencies":{"require-addon":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"b4a":"^1.6.7","brittle":"^3.1.0","prettier":"^3.5.3","cmake-bare":"^1.1.7","cmake-napi":"^1.0.2","cmake-fetch":"^1.1.0","bare-compat-napi":"^1.3.2","prettier-config-standard":"^7.0.0"},"_npmOperationalInternal":{"tmp":"tmp/quickbit-native_2.4.4_1746452261733_0.16905343088907787","host":"s3://npm-registry-packages-npm-production"},"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":1746452261985,"_cnpm_publish_time":1746452261985,"dist-tags":{"latest":"2.4.9"}}