I'm trying to write 16bit integers to a file, but didn't got the result I was expecting. For example:
>var d = new Uint16Array([255, 1111, 42])
=new Uint16Array([255, 1111, 42])
>var dr = fs.readFile("log0.txt")
\xFF is 255, ok for one byte.
1111 is 0100 0101 0111 in binary, and W is 87 character code, 0101 0111 binary. Looks like the lower byte of the 16 bit integer is saved.
* is 42, ok.
0100 0101 0111
My question is: Looks like saving typed arrays directly is not supported. Will it be, or what would be the best way to save this data as fast and efficient as possible?
Board is a Pixl running 2v08.188 (and of course shouldn't call a binary file .txt)
© Espruino, powered by microcosm.
Report a problem