This package has been deprecated

Author message:

this package has been deprecated, use bit-buffer instead

bitset-reader

1.1.0 • Public • Published

bitset-reader

NPM version Build Status

Read bits as a stream from a buffer

Based on https://www.npmjs.com/package/bitset

Installation

npm install bitset-reader

Usage

const BitSetReader = require('bitset-reader')

const buffer = Buffer.from('9d1319103c00000004390000001800a0006518042007730302','hex')

const reader = new BitSetReader(buffer)

console.log(reader.toString(16)) // display contained bitset as hex
console.log(reader.toString(2)) // display contained bitset as bits

console.log(reader.read(1)) // read a bit
console.log(reader.read(1)) // read a second bit

console.log(reader.read(8)) // read 8 bit as little endian following these 2 bits

API

new BitSetReader(buffer)

create a bitset reader from buffer

readBit()

read 1 bit from the bitset and increment the bit offset by 1

read(n) or readLE(n)

read n bits from the bitset as little endian and increment the bit offset by n

readBE(n)

read n bits from the bitset as big endian and increment the bit offset by n

toString(base)

convert bits to a string of base base

Related modules

/bitset-reader/

    Package Sidebar

    Install

    npm i bitset-reader

    Weekly Downloads

    7

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    5.18 kB

    Total Files

    7

    Last publish

    Collaborators

    • rom1504