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

Function main

benchmark/fs/bench-symlinkSync.js:18–51  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

16});
17
18function main({ n, type }) {
19 switch (type) {
20 case 'valid': {
21 tmpdir.refresh();
22 bench.start();
23 for (let i = 0; i < n; i++) {
24 fs.symlinkSync(tmpdir.resolve('.non-existent-symlink-file'), tmpdir.resolve(`.valid-${i}`), 'file');
25 }
26 bench.end(n);
27 break;
28 }
29
30 case 'invalid': {
31 let hasError = false;
32 bench.start();
33 for (let i = 0; i < n; i++) {
34 try {
35 fs.symlinkSync(
36 tmpdir.resolve('.non-existent-symlink-file'),
37 __filename,
38 'file',
39 );
40 } catch {
41 hasError = true;
42 }
43 }
44 bench.end(n);
45 assert.ok(hasError);
46 break;
47 }
48 default:
49 new Error('Invalid type');
50 }
51}

Callers

nothing calls this directly

Calls 6

refreshMethod · 0.45
startMethod · 0.45
symlinkSyncMethod · 0.45
resolveMethod · 0.45
endMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…