{"id":19122964,"url":"https://github.com/digitalbazaar/bitstring","last_synced_at":"2025-05-05T18:29:52.510Z","repository":{"id":38847754,"uuid":"277884457","full_name":"digitalbazaar/bitstring","owner":"digitalbazaar","description":"A Bitstring module for universal JavaScript","archived":false,"fork":false,"pushed_at":"2023-01-08T21:33:58.000Z","size":46,"stargazers_count":3,"open_issues_count":3,"forks_count":4,"subscribers_count":12,"default_branch":"main","last_synced_at":"2025-04-15T04:39:12.777Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/digitalbazaar.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-07T17:45:48.000Z","updated_at":"2023-01-08T21:38:36.000Z","dependencies_parsed_at":"2023-02-08T07:30:18.483Z","dependency_job_id":null,"html_url":"https://github.com/digitalbazaar/bitstring","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbitstring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbitstring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbitstring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/digitalbazaar%2Fbitstring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/digitalbazaar","download_url":"https://codeload.github.com/digitalbazaar/bitstring/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252552792,"owners_count":21766768,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T05:23:45.637Z","updated_at":"2025-05-05T18:29:52.492Z","avatar_url":"https://github.com/digitalbazaar.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bitstring\nA Bitstring module for universal JavaScript.\n\n## Install\n\nTo install get the latest version from NPM:\n\n```\nnpm install @digitalbazaar/bitstring\n```\n\nTo install locally for development:\n\n```\ngit clone https://github.com/digitalbazaar/bitstring.git\ncd bitstring\nnpm install\n```\n\n## Usage\n\n```js\nimport {Bitstring} from '@digitalbazaar/bitstring';\n\n// You can make a new instance by passing in a length\nconst bitstring = new Bitstring({length: 10});\n\n// OR by passing in a buffer\nconst buffer = Uint8Array.from([255]);\nconst bitstring = new Bitstring({buffer});\n```\n\n## API\n\n### set(position, on)\nSets the value of a bit for the given position to the given boolean.\n```js\nbitstring.set(1, true);\n```\n\n### get(position)\nGets the value of a bit for the given position.\n```js\nbitstring.get(3);\n```\n\n### encodeBits()\nCompresses and encodes bits to a base64url encoded string.\n\n```js\nawait bitstring.encodeBits();\n```\n\n### decodeBits({encoded})\nDecodes and uncompresses a given base64url encoded string to a Uint8Array.\n```js\nawait Bitstring.decodeBits({encoded});\n```\n\n### compressBits()\nCompresses bits to a Uint8Array.\n```js\nawait bitstring.compressBits();\n```\n\n### uncompressBits({compressed})\nUncompresses compressed bits.\n```js\nawait Bitstring.uncompressBits({compressed});\n```\n\n## Contribute\n\nPlease follow the existing code style.\n\nPRs accepted.\n\nIf editing the Readme, please conform to the\n[standard-readme](https://github.com/RichardLitt/standard-readme) specification.\n\n## Commercial Support\n\nCommercial support for this library is available upon request from\nDigital Bazaar: support@digitalbazaar.com\n\n## License\n\n[BSD-3-Clause](LICENSE.md) © Digital Bazaar\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fbitstring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigitalbazaar%2Fbitstring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigitalbazaar%2Fbitstring/lists"}