silverwolf-x's picture
download
raw
806 Bytes
import { rm as rmPromises } from 'fs/promises'
import { rm as rmCallback, rmSync } from 'fs'
import { promisify } from 'util'
const rmCallbackPromise = promisify(rmCallback)
const targetDir = process.argv[2]
const method = process.argv[3] // 'promises', 'callback', or 'sync'
async function test() {
const time = process.hrtime()
if (method === 'promises') {
await rmPromises(targetDir, { recursive: true, force: true })
} else if (method === 'callback') {
await rmCallbackPromise(targetDir, { recursive: true, force: true })
} else if (method === 'sync') {
rmSync(targetDir, { recursive: true, force: true })
}
const hrtime = process.hrtime(time)
const nanoseconds = hrtime[0] * 1e9 + hrtime[1]
const milliseconds = nanoseconds / 1e6
console.log(milliseconds)
}
test()

Xet Storage Details

Size:
806 Bytes
·
Xet hash:
7b78854a4014ddb8126eab554c1ec26df3321a6e09c7eaa0eb5a49fdffeb7fbc

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.