package
Pure JavaScript bit array/bitfield implementation
npm install bitarrayGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Estimated unpacked size across 2 packages.
166.1 kB
Includes dependencies.
BitArray is now depricated and aliased to BitSet.js. For full feature overview, consult the documentation.
The old API is still maintained for bitarray:
Create a bit array 1000 bits wide:
var ba = new BitArray(1000);Setting and reading bits:
ba.set(100, 1);
ba.get(100); // => 1
ba.set(100, 0);
ba.get(100); // = > 0More:
var ba = new BitArray(20);
[1,3,5,9,11,13,15].forEach(function(i){ ba.set(i, 1) });
ba.toString(); // => "01010100010101010000"Copyright (c) 2025, Robert Eisele Licensed under the MIT license.