node/benchmark/fs/bench-cpSync.js
Yelim Koo e1e7a417da
benchmark: remove force option as force defaults to true
PR-URL: https://github.com/nodejs/node/pull/54203
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
2024-08-06 15:20:45 +00:00

24 lines
584 B
JavaScript

'use strict';
const common = require('../common');
const fs = require('fs');
const path = require('path');
const tmpdir = require('../../test/common/tmpdir');
tmpdir.refresh();
const bench = common.createBenchmark(main, {
n: [1, 100, 10_000],
});
function main({ n }) {
tmpdir.refresh();
const options = { recursive: true };
const src = path.join(__dirname, '../../test/fixtures/copy');
const dest = tmpdir.resolve(`${process.pid}/subdir/cp-bench-${process.pid}`);
bench.start();
for (let i = 0; i < n; i++) {
fs.cpSync(src, dest, options);
}
bench.end(n);
}