Let's say I have a buffer constructed like this:
var buf = new Buffer(3);
buf.writeUInt16BE(258);
buf.write("a", 2);
and I only have the variable buf (no information about what's inside), how can I get something like this
[
{"value": 258, "type": "UInt16BE"},
{"value": "a", "type": "text"},
]
so I can console.log the content of the buffer?