Skip to content

Commit cc7b552

Browse files
anonrigH4ad
authored andcommitted
fixup! fs: add a fast-path for readFileSync utf-8
Backport-PR-URL: nodejs#48658
1 parent fdcc2da commit cc7b552

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/fs.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,8 @@ function readFileSync(path, options) {
466466

467467
// TODO(@anonrig): Do not handle file descriptor ownership for now.
468468
if (!isUserFd && (options.encoding === 'utf8' || options.encoding === 'utf-8')) {
469-
return readFileSyncUtf8(getValidatedPath(path), stringToFlags(options.flag));
469+
path = getValidatedPath(path);
470+
return readFileSyncUtf8(pathModule.toNamespacedPath(path), stringToFlags(options.flag));
470471
}
471472

472473
const fd = isUserFd ? path : fs.openSync(path, options.flag, 0o666);

0 commit comments

Comments
 (0)