Open this example in the interactive library
Source code
import { Buffer, isUtf8, isAscii } from "node:buffer";
console.log(Buffer.byteLength("café", "utf8"));
Sample output
5

Open this example in the interactive library
import { Buffer, isUtf8, isAscii } from "node:buffer";
console.log(Buffer.byteLength("café", "utf8"));
5