i've zmq implementation in node. i subscribe for one topic among all channels and got message in slow buffer object.
if i directly print that message on console, i got something like this.
<SlowBuffer 49 12 00 00 5a 00 00 00 00 00 00 00 00 00 00 01>
so this is slowbuffer object containing raw data. and i'm trying to convert it in readable format.
here is my code
console.log("Type of Message "+err.readInt8(0));
console.log("action "+err.readInt8(1));
var temp = "";
var s = ""
for (var i=0;i<8;i++) {
temp += err.readInt8(i + 8)
}
console.log("dpid "+temp);
output
Type of Message 73
action 18
dpid 00000003
now i have to format dpid in 00:00:00:00:00:00:00:02
this format. it may contain character and digit, hexadecimal. so i have
to convert dpid to hexa decimal and check whether it is two character
then oky otherwise i have to add extra "0" at front. something like
that. i'm very new to this concepts. i don't know how to do this ?
please help me.