Skip to content

Commit c655d38

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/fs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,8 @@ function readFileSync(path, options) {
471471

472472
const isUserFd = isFd(path); // File descriptor ownership
473473

474-
// TODO: Do not handle file descriptor ownership for now.
475-
if (!isUserFd && options.encoding === 'utf8') {
474+
// TODO(@anonrig): Do not handle file descriptor ownership for now.
475+
if (!isUserFd && (options.encoding === 'utf8' || options.encoding === 'utf-8')) {
476476
return readFileSyncUtf8(getValidatedPath(path), stringToFlags(options.flag));
477477
}
478478

0 commit comments

Comments
 (0)