* Asynchronously removes files and * directories (modeled on the standard POSIX `rm` utility). * @param {string | Buffer | URL} path * @param {{ * force?: boolean; * maxRetries?: number; * recursive?: boolean; * retryDelay?: number; * }} [options] * @param {(err?: Error) => any} c
(path, options, callback)
| 1443 | * @returns {void} |
| 1444 | */ |
| 1445 | function rm(path, options, callback) { |
| 1446 | if (typeof options === 'function') { |
| 1447 | callback = options; |
| 1448 | options = undefined; |
| 1449 | } |
| 1450 | |
| 1451 | const h = vfsState.handlers; |
| 1452 | if (h !== null && vfsVoid(h.rm(path, options), callback)) return; |
| 1453 | |
| 1454 | path = getValidatedPath(path); |
| 1455 | |
| 1456 | validateRmOptions(path, options, false, (err, options) => { |
| 1457 | if (err) { |
| 1458 | return callback(err); |
| 1459 | } |
| 1460 | lazyLoadRimraf(); |
| 1461 | return rimraf(path, options, callback); |
| 1462 | }); |
| 1463 | } |
| 1464 | |
| 1465 | /** |
| 1466 | * Synchronously removes files and |
no test coverage detected