Browse Source

fs: cache non-symlinks in realpathSync.

Extend `fs.realpathSync` to cache the results for paths that are not
symlinks in addition to caching symlink mappings.

PR-URL: https://github.com/nodejs/node/pull/10253
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6
Jeremy Yallop 8 years ago
committed by James M Snell
parent
commit
5dc44874c3
  1. 1
      lib/fs.js

1
lib/fs.js

@ -1528,6 +1528,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;
}

Loading…
Cancel
Save