Skip to content

Commit

Permalink
fixup! fs: add a fast-path for readFileSync utf-8
Browse files Browse the repository at this point in the history
Backport-PR-URL: nodejs#48658
  • Loading branch information
anonrig authored and H4ad committed Sep 17, 2023
1 parent 9f642c7 commit 58f5688
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}

Expand Down

0 comments on commit 58f5688

Please sign in to comment.