Skip to content

Commit f9ff4ec

Browse files
yallopMylesBorins
authored andcommitted
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: #10253 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 3210653 commit f9ff4ec

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

lib/fs.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1662,6 +1662,7 @@ fs.realpathSync = function realpathSync(p, options) {
16621662
var stat = fs.lstatSync(base);
16631663
if (!stat.isSymbolicLink()) {
16641664
knownHard[base] = true;
1665+
if (cache) cache.set(base, base);
16651666
continue;
16661667
}
16671668

0 commit comments

Comments
 (0)