MCPcopy Index your code
hub / github.com/nodejs/node / rmdir

Function rmdir

lib/fs.js:1376–1404  ·  view source on GitHub ↗

* Asynchronously removes a directory. * @param {string | Buffer | URL} path * @param {object} [options] * @param {(err?: Error) => any} callback * @returns {void}

(path, options, callback)

Source from the content-addressed store, hash-verified

1374 * @returns {void}
1375 */
1376function 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.

Callers

nothing calls this directly

Calls 3

vfsVoidFunction · 0.85
makeCallbackFunction · 0.70
rmdirMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…