MCPcopy Index your code
hub / github.com/nodejs/node / gotStat

Function gotStat

lib/fs.js:3479–3508  ·  view source on GitHub ↗
(err, stats)

Source from the content-addressed store, hash-verified

3477 }
3478
3479 function gotStat(err, stats) {
3480 if (err) return callback(err);
3481
3482 // If not a symlink, skip to the next path part
3483 if (!stats.isSymbolicLink()) {
3484 knownHard.add(base);
3485 return process.nextTick(LOOP);
3486 }
3487
3488 // Stat & read the link if not read before.
3489 // Call `gotTarget()` as soon as the link target is known.
3490 // `dev`/`ino` always return 0 on windows, so skip the check.
3491 let id;
3492 if (!isWindows) {
3493 const dev = BigIntPrototypeToString(stats.dev, 32);
3494 const ino = BigIntPrototypeToString(stats.ino, 32);
3495 id = `${dev}:${ino}`;
3496 if (seenLinks.has(id)) {
3497 return gotTarget(null, seenLinks.get(id));
3498 }
3499 }
3500 fs.stat(base, (err) => {
3501 if (err) return callback(err);
3502
3503 fs.readlink(base, (err, target) => {
3504 if (!isWindows) seenLinks.set(id, target);
3505 gotTarget(err, target);
3506 });
3507 });
3508 }
3509
3510 function gotTarget(err, target) {
3511 if (err) return callback(err);

Callers

nothing calls this directly

Calls 9

gotTargetFunction · 0.85
addMethod · 0.65
hasMethod · 0.65
getMethod · 0.65
callbackFunction · 0.50
isSymbolicLinkMethod · 0.45
statMethod · 0.45
readlinkMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…