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

Function LOOP

lib/fs.js:3447–3477  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3445 // Walk down the path, swapping out linked path parts for their real
3446 // values
3447 function LOOP() {
3448 // Stop if scanned past end of path
3449 if (pos >= p.length) {
3450 return callback(null, encodeRealpathResult(p, options));
3451 }
3452
3453 // find the next part
3454 const result = nextPart(p, pos);
3455 previous = current;
3456 if (result === -1) {
3457 const last = StringPrototypeSlice(p, pos);
3458 current += last;
3459 base = previous + last;
3460 pos = p.length;
3461 } else {
3462 current += StringPrototypeSlice(p, pos, result + 1);
3463 base = previous + StringPrototypeSlice(p, pos, result);
3464 pos = result + 1;
3465 }
3466
3467 // Continue if not a symlink, break if a pipe/socket
3468 if (knownHard.has(base)) {
3469 if (isFileType(statValues, S_IFIFO) ||
3470 isFileType(statValues, S_IFSOCK)) {
3471 return callback(null, encodeRealpathResult(p, options));
3472 }
3473 return process.nextTick(LOOP);
3474 }
3475
3476 return fs.lstat(base, { bigint: true }, gotStat);
3477 }
3478
3479 function gotStat(err, stats) {
3480 if (err) return callback(err);

Callers 2

realpathFunction · 0.85
gotResolvedLinkFunction · 0.85

Calls 5

encodeRealpathResultFunction · 0.85
isFileTypeFunction · 0.85
hasMethod · 0.65
callbackFunction · 0.50
lstatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…