MCPcopy Create free account
hub / github.com/DustinBrett/daedalOS / recur

Function recur

scripts/fs2json.js:51–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

49 : files;
50
51 const recur = () => {
52 const file = includedFiles.shift();
53
54 if (file) {
55 const fullPath = join(walkDir, file);
56
57 stat(fullPath, (statError, fileStat) => {
58 if (statError) {
59 reject(statError);
60 return;
61 }
62
63 const name = basename(fullPath);
64 const node = makeNode(fileStat, name);
65
66 if (fileStat.isSymbolicLink()) {
67 readlink(fullPath, (linkError, path) => {
68 if (!linkError) {
69 node[IDX_TARGET] = path;
70 result.push(node);
71 recur();
72 }
73 });
74 } else if (fileStat.isDirectory()) {
75 walk(fullPath).then((rest) => {
76 node[IDX_TARGET] = rest;
77 result.push(node);
78 recur();
79 });
80 } else {
81 result.push(node);
82 recur();
83 }
84 });
85 } else {
86 resolve(result);
87 }
88 };
89
90 recur();
91 });

Callers 1

walkFunction · 0.85

Calls 11

rejectFunction · 0.85
makeNodeFunction · 0.85
walkFunction · 0.85
joinFunction · 0.50
statFunction · 0.50
basenameFunction · 0.50
readlinkFunction · 0.50
resolveFunction · 0.50
shiftMethod · 0.45
pushMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected