Skip to content

Latest commit

 

History

History
30 lines (25 loc) · 716 Bytes

README.md

File metadata and controls

30 lines (25 loc) · 716 Bytes

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