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 :)
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:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.