0

I was playing around with the Nodejs Buffer.from(<string>).toString("utf16le") but I can't find an HTML/DOM equivalent without browserify and whatnot. Is there an easy way to do this?

Komali
  • 196
  • 9
  • This used to be possible with `TextEncoder`, but `utf-16` and `utf-16le` has been removed it seems. Maybe try a polyfill, like some mentioned [here](https://stackoverflow.com/questions/32937088/javascript-create-utf-16-text-file). – Radvylf Programs Dec 08 '21 at 16:22

1 Answers1

0
function debuffer(array){
    let td=new TextDecoder
    let raw=new Uint8Array(array)
    return td.decode(ua)
}

should do the job