From 7495bcbf77349d708b249944a149c16f5ee0c667 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Fri, 2 Aug 2024 16:23:21 +0200 Subject: Revert "perf(ext/node): improve `Buffer` from string performance" (#24851) --- ext/node/polyfills/internal_binding/_utils.ts | 17 ----------------- 1 file changed, 17 deletions(-) (limited to 'ext/node/polyfills/internal_binding/_utils.ts') diff --git a/ext/node/polyfills/internal_binding/_utils.ts b/ext/node/polyfills/internal_binding/_utils.ts index 0b1e1709d..74dc3cbcd 100644 --- a/ext/node/polyfills/internal_binding/_utils.ts +++ b/ext/node/polyfills/internal_binding/_utils.ts @@ -7,7 +7,6 @@ import { forgivingBase64Decode, forgivingBase64UrlDecode, } from "ext:deno_web/00_infra.js"; -import { op_base64_write } from "ext:core/ops"; export function asciiToBytes(str: string) { const length = str.length; @@ -28,22 +27,6 @@ export function base64ToBytes(str: string) { } } -export function base64Write( - str: string, - buffer: Uint8Array, - offset: number = 0, - length?: number, -): number { - length = length ?? buffer.byteLength - offset; - try { - return op_base64_write(str, buffer, offset, length); - } catch { - str = base64clean(str); - str = str.replaceAll("-", "+").replaceAll("_", "/"); - return op_base64_write(str, buffer, offset, length); - } -} - const INVALID_BASE64_RE = /[^+/0-9A-Za-z-_]/g; function base64clean(str: string) { // Node takes equal signs as end of the Base64 encoding -- cgit v1.2.3