npm.io
1.0.4 • Published 11 years ago

nybble

Licence
MIT
Version
1.0.4
Deps
0
Vulns
0
Weekly
0

Nybble

Read bits from a buffer or octet array.

Installation

npm install nybble

Usage

nybble = require 'nybble'

buffer = nybble.bitBuffer [0xca, 0xfe]
a = buffer.readUnsigned 0, 4

# a should be equal to 0xa
readUnsigned(bitOffset, bitLength)

Returns the unsigned integer value.

readSigned(bitOffset, bitLength)

Returns the signed integer value.

readFloat(bitOffset)

Returns the single precision IEEE 754 float.

readDouble(bitOffset)

Returns the double precision IEEE 754 float.

Keywords