You are reading a single comment by @AkosLukacs and its replies. Click here to read the full conversation.
  • 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])
    >d[0]
    =255
    >d[1]
    =1111
    >d[2]
    =42
    >fs.appendFile("log0.txt", d)
    =true
    >var dr = fs.readFile("log0.txt")
    ="\xFFW*"
    >dr.charCodeAt(0)
    =255
    >dr.charCodeAt(1)
    =87
    >dr.charCodeAt(2)
    =42
    

    \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.

    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)

About

Avatar for AkosLukacs @AkosLukacs started