From d3276fdc63b34a2d6035e15106b74af73ea1b241 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Mon, 12 Dec 2016 15:56:36 +0000 Subject: [PATCH] Cache non-symlinks in realpathSync. Extend `fs.realpathSync` to cache the results for paths that are not symlinks in addition to caching symlink mappings. Signed-off-by: Jeremy Yallop --- lib/fs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/fs.js b/lib/fs.js index 27614e5cf1febc..f60e3cf11b5614 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -1531,6 +1531,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; }