• 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
13function main({ n, dir, withFileTypes }) {
14  withFileTypes = withFileTypes === 'true';
15  const fullPath = path.resolve(__dirname, '../../', dir);
16  bench.start();
17  (function r(cntr) {
18    if (cntr-- <= 0)
19      return bench.end(n);
20    fs.readdir(fullPath, { withFileTypes }, () => {
21      r(cntr);
22    });
23  }(n));
24}
25