BITS和BYTES用于解码二进制或流消息的简单轻量级框架。

npm安装位和字节位操作:


var BitsAndBytes = require('bitsandbytes');

var decoder = new BitsAndBytes();

var msg = '4564657894916574879836';

var bufferStreams = new Buffer(msg,'hex');



//Big Endian

console.log(\"Bit : \", decoder.decodeBE(bufferStreams, {type : 'bit', start: 0, length: 1, bitStart: 0, bitLength: 3, signed: false }));



//Little Endian

console.log(\"Bit : \");