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 Dec 2, 2023
1 parent 3703195 commit a87fa4a
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 @@ -464,8 +464,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 a87fa4a

Please sign in to comment.