I am trying to read a buffer as string using node.js i am using api which is return buffer when i console buffer it looks like
<Buffer 00 05 02 00 00 00 00 00 20 20 20 20 20 20 30 31 30 36 35 37 30 30 31 3534 35 37 38 34 20 01 c6 03 b4 03 cc 0c 04 21 de 01 3b b0 a1 ff 8a 48 80 01 50 06 ...>
My code is:-
server.on("message", function (buffer){
console.log(buffer);//this is buffer
console.log(buffer.toString());
});
when I try to convert into string it give the following output:-
♣☻ 010657001545784 ☺?♥?♥?♀♦!?☺;????H?☺P♠?☻.? ?♠
;
I have also try to conver it utf-8
but no luck.
can anyone tell me which is this format and how I can get proper string from this.
Thanks for your help.