Last active
January 21, 2025 17:53
-
-
Save sammachin/12a7eb0278fc7634849f2581fbad6528 to your computer and use it in GitHub Desktop.
decode a UTF 8 array of characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode 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