JavaScript:
const str = "fuck";
const buf = new TextEncoder("utf-16LE").encode(str);
let file = hmFS.open('xxx.txt', hmFS.O_RDWR | hmFS.O_CREAT)
hmFS.write(file, buf.buffer, 0, buf.length)
hmFS.read(file, buf.buffer, 0, buf.length)
const decoder = new TextDecoder('utf-16LE')
const readStr = decoder.decode(buf)
console.log(readStr)