Open this example in the interactive library
Source code
import { Buffer, isUtf8, isAscii } from "node:buffer";
console.log(Buffer.from([65, 0, 66, 0]).toString("utf16le"));
Sample output
AB

Open this example in the interactive library
import { Buffer, isUtf8, isAscii } from "node:buffer";
console.log(Buffer.from([65, 0, 66, 0]).toString("utf16le"));
AB