Skip to content

Commit a87fa4a

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

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/fs.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -464,8 +464,8 @@ function readFileSync(path, options) {
464464

465465
const isUserFd = isFd(path); // File descriptor ownership
466466

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

0 commit comments

Comments
 (0)