From c48bb41a8e514c7e0bf614c42b680f9e6de2fc68 Mon Sep 17 00:00:00 2001 From: filesite Date: Sat, 13 Apr 2024 22:53:43 +0800 Subject: [PATCH] change string bytes get function --- common.mjs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common.mjs b/common.mjs index 3db03f1..c120597 100644 --- a/common.mjs +++ b/common.mjs @@ -5,6 +5,7 @@ import fs from 'node:fs'; import { readdir, readFile } from 'node:fs/promises'; import { resolve } from 'node:path'; +import { Buffer } from 'node:buffer'; import md5 from 'md5'; class Common { @@ -209,7 +210,7 @@ class Common { } byteSize(str) { - return new Blob([str]).size; + return Buffer.byteLength(str, 'utf8'); } }