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

Function main

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

Source from the content-addressed store, hash-verified

11});
12
13function main({ n, type }) {
14 switch (type) {
15 case 'existing': {
16 for (let i = 0; i < n; i++) {
17 fs.writeFileSync(tmpdir.resolve(`chmodsync-bench-file-${i}`), 'bench');
18 }
19
20 bench.start();
21 for (let i = 0; i < n; i++) {
22 fs.chmodSync(tmpdir.resolve(`chmodsync-bench-file-${i}`), 0o666);
23 }
24 bench.end(n);
25 break;
26 }
27 case 'non-existing':
28 bench.start();
29 for (let i = 0; i < n; i++) {
30 try {
31 fs.chmodSync(tmpdir.resolve(`chmod-non-existing-file-${i}`), 0o666);
32 } catch {
33 // do nothing
34 }
35 }
36 bench.end(n);
37 break;
38 default:
39 new Error('Invalid type');
40 }
41}

Callers

nothing calls this directly

Calls 5

writeFileSyncMethod · 0.45
resolveMethod · 0.45
startMethod · 0.45
chmodSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…