MCPcopy Create free account
hub / github.com/nodejs/node / main

Function main

benchmark/fs/bench-existsSync.js:16–38  ·  view source on GitHub ↗
({ n, type })

Source from the content-addressed store, hash-verified

14});
15
16function main({ n, type }) {
17 let path;
18
19 switch (type) {
20 case 'existing':
21 path = __filename;
22 break;
23 case 'non-flat-existing':
24 path = tmpfile;
25 break;
26 case 'non-existing':
27 path = tmpdir.resolve(`.non-existing-file-${process.pid}`);
28 break;
29 default:
30 new Error('Invalid type');
31 }
32
33 bench.start();
34 for (let i = 0; i < n; i++) {
35 fs.existsSync(path);
36 }
37 bench.end(n);
38}

Callers

nothing calls this directly

Calls 4

resolveMethod · 0.45
startMethod · 0.45
existsSyncMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected