2

Currently I am receiving a message with my udp server it arrives as <Buffer 43 31 07 55 56> this is supposed to be an ID 4331075556

  • obj.toString() returns C1UV
  • parseInt(obj) returns NaN
  • JSON.stringify(obj) returns [67,49,7,85,86]

How can I convert <Buffer 43 31 07 55 56> to 4331075556?

1 Answer 1

7

you need to specify an additional argument in toString():

obj.toString('hex')
Sign up to request clarification or add additional context in comments.

1 Comment

Awesome, missed the encoding list, tried binary & ascii mentioned in another doc. I didn't think of the values as being hex.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.