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>
This commit is contained in:
parent
17eb8fce05
commit
5dc44874c3
@ -1528,6 +1528,7 @@ fs.realpathSync = function realpathSync(p, options) {
|
|||||||
var stat = fs.lstatSync(base);
|
var stat = fs.lstatSync(base);
|
||||||
if (!stat.isSymbolicLink()) {
|
if (!stat.isSymbolicLink()) {
|
||||||
knownHard[base] = true;
|
knownHard[base] = true;
|
||||||
|
if (cache) cache.set(base, base);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user