1.0.2 • Published 5 years ago

bit-array-buffer v1.0.2

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

JavaScript Bit Array Library with ArrayBuffer

This library contains a JavaScript implementation of bit arrays. The library supports:

  • create by arrayBuffer and init by unit8Array
  • getting and setting

The bit array is continuous. The following example shows how to set and get individual bits within the array:

    /* typescript */
    import {BIT, BitArray} from 'bit-array-buffer';

    a = new BitArray(32);
    a.set(0, BIT.ON);
    a.set(31, BIT.OFF);
    a.get(30);
    /* javascript */
    import BitArray from 'bit-array-buffer';
    a = new BitArray(32);
    a.set(0, 1);
    a.set(31, 1);
    a.get(30);

Installation

    npm i bit-array-buffer