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

Function copyDir

test/parallel/test-require-symlink.js:32–44  ·  view source on GitHub ↗
(source, target)

Source from the content-addressed store, hash-verified

30tmpdir.refresh();
31
32function copyDir(source, target) {
33 fs.mkdirSync(target);
34 fs.readdirSync(source).forEach((entry) => {
35 const fullPathSource = path.join(source, entry);
36 const fullPathTarget = path.join(target, entry);
37 const stats = fs.statSync(fullPathSource);
38 if (stats.isDirectory()) {
39 copyDir(fullPathSource, fullPathTarget);
40 } else {
41 fs.copyFileSync(fullPathSource, fullPathTarget);
42 }
43 });
44}
45
46copyDir(fixtureSource, tmpDirTarget);
47

Callers 1

Calls 7

forEachMethod · 0.65
mkdirSyncMethod · 0.45
readdirSyncMethod · 0.45
joinMethod · 0.45
statSyncMethod · 0.45
isDirectoryMethod · 0.45
copyFileSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…