package
Bitstring module for universal JavaScript
npm install @digitalbazaar/bitstringGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A Bitstring module for universal JavaScript.
To install get the latest version from NPM:
npm install @digitalbazaar/bitstringTo install locally for development:
git clone https://github.com/digitalbazaar/bitstring.git
cd bitstring
npm installimport {Bitstring} from '@digitalbazaar/bitstring';
// You can make a new instance by passing in a length
const bitstring = new Bitstring({length: 10});
// OR by passing in a buffer
const buffer = Uint8Array.from([255]);
const bitstring = new Bitstring({buffer});Sets the value of a bit for the given position to the given boolean.
bitstring.set(1, true);Gets the value of a bit for the given position.
bitstring.get(3);Compresses and encodes bits to a base64url encoded string.
await bitstring.encodeBits();Decodes and uncompresses a given base64url encoded string to a Uint8Array.
await Bitstring.decodeBits({encoded});Compresses bits to a Uint8Array.
await bitstring.compressBits();Uncompresses compressed bits.
await Bitstring.uncompressBits({compressed});Please follow the existing code style.
PRs accepted.
If editing the Readme, please conform to the standard-readme specification.
Commercial support for this library is available upon request from Digital Bazaar: support@digitalbazaar.com
BSD-3-Clause © Digital Bazaar
msporny
msporny@digitalbazaar.com
Estimated unpacked size across 4 packages.
2.4 MB
Includes dependencies.