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 <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
yallop authored and MylesBorins committed Jan 31, 2017
1 parent 5f18f0c commit 709b9b4
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 709b9b4

Please sign in to comment.