Reputation: 373
I have a buffer in this format:
<Buffer 24 b0 5e 65 3f 26 74 4e 9a ba 87 35 2d 83 cd 54 17 09 9b 1b cc 72 58 16 99 6d d6 5c b7 fa b6 63>
And I need to convert it to hex format:
24b05e653f26744e9aba87352d83cd5417099b1bcc725816996dd65cb7fab663
All the examples I see do it like this, but it has no effect when I try it.
b=getBuffer(data);
console.log(b);
hex=Buffer.from(b, 'hex')
console.log(hex);
OUTPUT:
<Buffer 24 b0 5e 65 3f 26 74 4e 9a ba 87 35 2d 83 cd 54 17 09 9b 1b cc 72 58 16 99 6d d6 5c b7 fa b6 63>
<Buffer 24 b0 5e 65 3f 26 74 4e 9a ba 87 35 2d 83 cd 54 17 09 9b 1b cc 72 58 16 99 6d d6 5c b7 fa b6 63>
Any ideas? Thanks in advance.
Upvotes: 3
Views: 5186
Reputation: 439
For whoever getting the warning Invalid number of arguments, expected 0
with the solution proposed by @TwistedOwl, here a solution to get rid of the warning:
Buffer.from(b).toString('hex');
Upvotes: 0