Background
I am attempting to iterate over a buffer object which basically contains hex values. That is perfect for me as each hex value is something I need to decode. However when I loop through the array they get converted to decimal values. How can I loop through it without the values getting converted?
My code
console.log(encoded)
const buf = Buffer.from(encoded)
for (const item of buf) {
console.log(item)
}
Some of my output
<Buffer 0c 00 00 00 99 4e 98 3a f0 9d 09 3b 00 00 00 00 68 48 12 3c f0 77 1f 4a 6c 6c 0a 4a 0f 32 5f 31 31 39 38 36 31 5f 31 33 33 39 33 39 40 fc 11 00 09 00 ... 336 more bytes>
12
0
0
0
153
78
152
58
240
157
9
...
The original output <Buffer 0c 00 ...... is desired as I can for instance take each output like 0c and do something meaningful with it.
yourNumber.toString(16);