Skip to content

Commit

Permalink
fs: cache non-symlinks in realpathSync.
Browse files Browse the repository at this point in the history
Extend `fs.realpathSync` to cache the results for paths that are not
symlinks in addition to caching symlink mappings.

PR-URL: #10253
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
yallop authored and MylesBorins committed Jan 24, 2017
1 parent 3210653 commit f9ff4ec
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -1662,6 +1662,7 @@ fs.realpathSync = function realpathSync(p, options) {
var stat = fs.lstatSync(base);
if (!stat.isSymbolicLink()) {
knownHard[base] = true;
if (cache) cache.set(base, base);
continue;
}

Expand Down

0 comments on commit f9ff4ec

Please sign in to comment.