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

Function main

benchmark/fs/bench-copyFileSync.js:13–37  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

11});
12
13function main({ n, type }) {
14 tmpdir.refresh();
15 const dest = tmpdir.resolve(`copy-file-bench-${process.pid}`);
16 let path;
17
18 switch (type) {
19 case 'invalid':
20 path = tmpdir.resolve(`.existing-file-${process.pid}`);
21 break;
22 case 'valid':
23 path = __filename;
24 break;
25 default:
26 throw new Error('Invalid type');
27 }
28 bench.start();
29 for (let i = 0; i < n; i++) {
30 try {
31 fs.copyFileSync(path, dest);
32 } catch {
33 // do nothing
34 }
35 }
36 bench.end(n);
37}

Callers

nothing calls this directly

Calls 5

refreshMethod · 0.45
resolveMethod · 0.45
startMethod · 0.45
copyFileSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…