• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4const fs = require('fs');
5const path = require('path');
6
7const bench = common.createBenchmark(main, {
8  n: [10],
9  dir: [ 'lib', 'test/parallel'],
10  withFileTypes: ['true', 'false']
11});
12
13
14function main({ n, dir, withFileTypes }) {
15  withFileTypes = withFileTypes === 'true';
16  const fullPath = path.resolve(__dirname, '../../', dir);
17  bench.start();
18  for (let i = 0; i < n; i++) {
19    fs.readdirSync(fullPath, { withFileTypes });
20  }
21  bench.end(n);
22}
23