Skip to content

Instantly share code, notes, and snippets.

@sammachin
Last active January 21, 2025 17:53
Show Gist options
  • Save sammachin/12a7eb0278fc7634849f2581fbad6528 to your computer and use it in GitHub Desktop.
Save sammachin/12a7eb0278fc7634849f2581fbad6528 to your computer and use it in GitHub Desktop.
decode a UTF 8 array of characters
const { StringDecoder } = require('node:string_decoder');
const decoder = new StringDecoder('utf8');
function decode(raw){
let buf = Buffer.from(raw)
let str = decoder.write(buf)
return str
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment