{"name":"quickbit-native","version":"2.0.3","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":"7d6bb0264cf63aec0d1337a879886aeb0971b65c","_id":"quickbit-native@2.0.3","_nodeVersion":"19.7.0","_npmVersion":"9.5.0","dist":{"integrity":"sha512-hUw5/Ps7bZQAcKhLTfXD0513/qfiFn0yk9+7ovBWO6cDENpiL9XwDqh5WdAZRWOHjkgtLK5eLF5kXTaUXftUAA==","shasum":"5883a1e4ff509ee94c5af76eb95284796f398b6b","tarball":"http://registry-npm.ywwl.com/quickbit-native/download/quickbit-native-2.0.3.tgz","fileCount":38,"unpackedSize":341930,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCjbuUr4LcovTcCrPvDy9sPoOZixilegQwpB+TdIQtBUgIgVOavEFLtwEvzbbuCb2kEU9sIdHJg+oluALyp5qeBLbQ="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkHa9zACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2Vmrszw//UPRwAyAgDvJYe45hbbzyhqm5UxL5R2tLXdqkakHpJMTPaHEF\r\n553Z/1SfZF2uij4nf27iB14iGecxF4gxDx9s/DxP4nZeQ/RHbP5WyM8UyBIm\r\ncG+SA9M45Y9Pddx4MC1ddgY4yUr9KDSjbAANBdofxvq4Kva6yqPM90Bi+25y\r\nfYzPMK9vXp+R8RJJsl1Osm5ghtMqIsuJVk8Rcr7uWmh3b2x6M4WERVmn2PwW\r\nFTtYVbvB7t17wOKEsa04CCvNOcp4wid3sC6Hl7PDmOSf0uz3MOqPqo9QRAdL\r\n3yaRPMlCROilINODlJmyHZRj2cSfCjiNpX3yrTtxwcpXHHwwTFdT7oh5Wy3A\r\n2L3hAkvJhDuIdGrv7vevZkUSYU2nWLxxkYwdKMTT9WJRnjvRlQIdbvqezSOs\r\nUgz6eC79avW6yVWW7icrIN3HSYz2Jcqoh3T/h7nct/t94ItmsUSMFWfhIlU0\r\n6Avqk8//DqqJbk4S5eT9UGWl6MgQDunIqpwePk2loXpAdrmh5Z3brrWar/mH\r\nbVUZpkIG96te0YHuwahwL1P3CKLEE+nCqorBD8YPBFKI1L4HNSDRrCRU0oFI\r\nQuk2F8jHOUgz9pMteRPcd6uGHEOVFP1CMVLN4coZwKRlM2LOXtPdo2LWgOa4\r\nuSDUywkPcbPYiCNpx1iQkkLoFw24gkN82qA=\r\n=NOJC\r\n-----END PGP SIGNATURE-----\r\n","size":108281,"noattachment":false,"key":"/quickbit-native/-/quickbit-native-2.0.3.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_2.0.3_1679667059002_0.3973570778093196"},"_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":1679667059161,"_cnpm_publish_time":1679667059161,"dist-tags":{"latest":"2.4.9"}}