diff --git a/ext/node/polyfills/internal/buffer.mjs b/ext/node/polyfills/internal/buffer.mjs index 29c0a5584b..6f31212331 100644 --- a/ext/node/polyfills/internal/buffer.mjs +++ b/ext/node/polyfills/internal/buffer.mjs @@ -35,6 +35,8 @@ import { import { atob, btoa } from "ext:deno_web/05_base64.js"; import { Blob } from "ext:deno_web/09_file.js"; +const { core } = globalThis.__bootstrap; + export { atob, Blob, btoa }; const utf8Encoder = new TextEncoder(); @@ -2126,7 +2128,7 @@ export function readInt40BE(buf, offset = 0) { } export function byteLengthUtf8(str) { - return utf8Encoder.encode(str).length; + return core.byteLength(str); } function base64ByteLength(str, bytes) {