rsnext/bench/recursive-delete/rimraf.js
matamatanot c922c6a3f4
Replace 'require' with 'import' in bench files and update dependancies (#25775)
## Feature

- [ ] Telemetry added. In case of a feature if it's used or not.

### Replace 'require' with 'import' in bench files
Node.js 12 allows you to use `import`.

### Update dependancies
https://github.com/jprichardson/node-fs-extra/blob/master/CHANGELOG.md#breaking-changes

> Require Node.js v12+

For #25761, Node.js 12 is required. Therefore, there is no problem updating it. For benchmarking purposes, it would be reasonable to update to the latest version.
2021-06-04 14:30:52 +00:00

18 lines
463 B
JavaScript

import { join } from 'path'
import { promisify } from 'util'
import rimrafMod from 'rimraf'
const rimraf = promisify(rimrafMod)
const resolveDataDir = join(__dirname, `fixtures-${process.argv[2]}`, '**/*')
async function test() {
const time = process.hrtime()
await rimraf(resolveDataDir)
const hrtime = process.hrtime(time)
const nanoseconds = hrtime[0] * 1e9 + hrtime[1]
const milliseconds = nanoseconds / 1e6
console.log(milliseconds)
}
test()