mtlv
v0.0.3
Published
MiniTLV encoder/decoder
Downloads
14
Readme
mtlv
MiniTLV - TLV inspired binary protocol.
Packet layout
- Header byte: Length([8:tagBits]) Tag([tagBits:0])
- Rest bytes: Value array
Installation
Install from NPM:
$ npm install mtlv --saveExamples
const mtlv = new MTLV();
const packet = mtlv.encode(0x1, [0x2, 0x4]);
const { tag, length, value } = mtlv.decode(packet));
const parser = new MTLVParser();
const { tag, length, value } = parser.parse([0x21, 0x2, 0x4]);