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

Function createEntryPoint

benchmark/module/module-require.js:56–80  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

54}
55
56function createEntryPoint(n) {
57 fs.mkdirSync(benchmarkDirectory);
58
59 const JSFileContent = 'module.exports = [];';
60 const JSONFileContent = '[]';
61
62 for (let i = 0; i < n; i++) {
63 // JS file.
64 fs.writeFileSync(`${benchmarkDirectory}/${i}.js`, JSFileContent);
65
66 // JSON file.
67 fs.writeFileSync(`${benchmarkDirectory}/json_${i}.json`, JSONFileContent);
68
69 // Dir.
70 fs.mkdirSync(`${benchmarkDirectory}${i}`);
71 fs.writeFileSync(
72 `${benchmarkDirectory}${i}/package.json`,
73 '{"main": "index.js"}',
74 );
75 fs.writeFileSync(
76 `${benchmarkDirectory}${i}/index.js`,
77 JSFileContent,
78 );
79 }
80}

Callers 1

setupFunction · 0.85

Calls 2

mkdirSyncMethod · 0.45
writeFileSyncMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…