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?

asked Nov 4, 2021 at 16:21
1
  • 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. Commented Dec 8, 2021 at 16:22

1 Answer 1

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

should do the job

answered Aug 7, 2022 at 5:01
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.