Skip to content

Commit fccbb41

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

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/fs.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,8 @@ function readFileSync(path, options) {
473473

474474
// TODO(@anonrig): Do not handle file descriptor ownership for now.
475475
if (!isUserFd && (options.encoding === 'utf8' || options.encoding === 'utf-8')) {
476-
return readFileSyncUtf8(getValidatedPath(path), stringToFlags(options.flag));
476+
path = getValidatedPath(path);
477+
return readFileSyncUtf8(pathModule.toNamespacedPath(path), stringToFlags(options.flag));
477478
}
478479

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

0 commit comments

Comments
 (0)