Reputation: 2490
I have an Array:
var dataArray = new Uint16Array(256);
then my array goes over nodeJs to an other pc. (nodejs binaryType = "arraybuffer")
How do I know on the other client that i have to cast to Uint16Array and not Uint8Array?
Note: the bit depth and array length is a dynamic value and can change while programm is running.
Thanks :)
Upvotes: 0
Views: 110
Reputation: 8123
When transferring data as ArrayBuffer
its just binary buffer data, you need to know with what view you want to access the data with. TypedArrays
are just a view on a binary ArrayBuffer
.
There are several ways to handle this:
Upvotes: 1