This is my toHexString function:
function toHexString(bytes) {
return bytes.map(function (byte) {
return ("00" + (byte & 0xFF).toString(16)).slice(-2)
}).join('')
}
And this is what I have done in Chrome Console:
> var bitmapArray = new Uint8Array(buffer);
undefined
> toHexString(bitmapArray.subarray(0,3))
"2100"
> bitmapArray.subarray(0,3)
[33, 29, 31]
> toHexString([33,29,31])
"211d1f"
It seems that toHexString function cannot work properly. What's the problem?