A big-endian extractor for groups of bits.
bit-extract is a big-endian extractor for groups of bits. You give it a number, and it gives you the value of groups of bits, starting from the most significant end of the number.
If you have npm installed, just run
npm install bit-extract
var bit_extract = require'bit-extract';/* Set up a bit reader. Specify the value and how many bits it has. */var bx = bit_extract305419896 32; // 305419896 is 0x12345678 hexadecimal/* Extract the bits */console.logbxextract_bits4;console.logbxextract_bits4;console.logbxextract_bits8toString16;console.logbxextract_bits16toString16;
use this to extract values from a buffer. The node.js buffer object can do this for you, and can probably do it much better than this can.