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

Function main

benchmark/fs/bench-linkSync.js:17–50  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

startMethod · 0.45
linkSyncMethod · 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…