* Asynchronously removes a directory. * @param {string | Buffer | URL} path * @param {object} [options] * @param {(err?: Error) => any} callback * @returns {void}
(path, options, callback)
| 1374 | * @returns {void} |
| 1375 | */ |
| 1376 | function rmdir(path, options, callback) { |
| 1377 | if (typeof options === 'function') { |
| 1378 | callback = options; |
| 1379 | options = undefined; |
| 1380 | } |
| 1381 | |
| 1382 | const h = vfsState.handlers; |
| 1383 | if (h !== null && vfsVoid(h.rmdir(path), callback)) return; |
| 1384 | |
| 1385 | if (options?.recursive !== undefined) { |
| 1386 | // This API previously accepted a `recursive` option that was deprecated |
| 1387 | // and removed. However, in order to make the change more visible, we |
| 1388 | // opted to throw an error if recursive is specified rather than removing it |
| 1389 | // entirely. |
| 1390 | throw new ERR_INVALID_ARG_VALUE( |
| 1391 | 'options.recursive', |
| 1392 | options.recursive, |
| 1393 | 'is no longer supported', |
| 1394 | ); |
| 1395 | } |
| 1396 | |
| 1397 | callback = makeCallback(callback); |
| 1398 | path = getValidatedPath(path); |
| 1399 | |
| 1400 | validateRmdirOptions(options); |
| 1401 | const req = new FSReqCallback(); |
| 1402 | req.oncomplete = callback; |
| 1403 | binding.rmdir(path, req); |
| 1404 | } |
| 1405 | |
| 1406 | /** |
| 1407 | * Synchronously removes a directory. |
nothing calls this directly
no test coverage detected
searching dependent graphs…