From 58f56888af2d113dd60d69a033446ac4a07e125b Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Thu, 6 Jul 2023 10:08:13 -0400 Subject: [PATCH] fixup! fs: add a fast-path for readFileSync utf-8 Backport-PR-URL: https://github.com/nodejs/node/pull/48658 --- lib/fs.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/fs.js b/lib/fs.js index d1d67185c0370d..a2e3ba2c7f1ab7 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -471,8 +471,8 @@ function readFileSync(path, options) { const isUserFd = isFd(path); // File descriptor ownership - // TODO: Do not handle file descriptor ownership for now. - if (!isUserFd && options.encoding === 'utf8') { + // TODO(@anonrig): Do not handle file descriptor ownership for now. + if (!isUserFd && (options.encoding === 'utf8' || options.encoding === 'utf-8')) { return readFileSyncUtf8(getValidatedPath(path), stringToFlags(options.flag)); }