From 5dc44874c319f1a91d53c9e8857bc2c63eea3827 Mon Sep 17 00:00:00 2001 From: Jeremy Yallop Date: Mon, 12 Dec 2016 15:56:36 +0000 Subject: [PATCH] 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 Reviewed-By: James M Snell --- lib/fs.js | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/fs.js b/lib/fs.js index bd027c34279..c4f7d706173 100644 --- a/lib/fs.js +++ b/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; }