{"name":"rimraf","version":"6.1.3","keywords":["rm","rm -rf","rm -fr","remove","directory","cli","rmdir","recursive"],"author":{"url":"http://blog.izs.me/","name":"Isaac Z. Schlueter","email":"i@izs.me"},"license":"BlueOak-1.0.0","_id":"rimraf@6.1.3","maintainers":[{"name":"isaacs","email":"i@izs.me"}],"homepage":"https://github.com/isaacs/rimraf#readme","bugs":{"url":"https://github.com/isaacs/rimraf/issues"},"bin":{"rimraf":"dist/esm/bin.mjs"},"dist":{"shasum":"afbee236b3bd2be331d4e7ce4493bac1718981af","tarball":"http://registry-npm.ywwl.com/rimraf/download/rimraf-6.1.3.tgz","fileCount":137,"integrity":"sha512-LKg+Cr2ZF61fkcaK1UdkH2yEBBKnYjTyWzTJT6KNPcSPaiT7HSdhtMXQuN5wkTX0Xu72KQ1l8S42rlmexS2hSA==","signatures":[{"sig":"MEUCIFlQuwlbArZftXcWHqGaZD4MK3VOCgeSFBvFH6BALoxOAiEAjPl/Uw4Rn9Jh4B3fsWz19s3o1FFw6kCx1fyB31NupMg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":261819,"size":39858,"noattachment":false,"key":"/rimraf/-/rimraf-6.1.3.tgz"},"main":"./dist/commonjs/index.js","tshy":{"main":true,"exports":{".":"./src/index.ts","./package.json":"./package.json"}},"type":"module","types":"./dist/commonjs/index.d.ts","module":"./dist/esm/index.js","engines":{"node":"20 || >=22"},"exports":{".":{"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./package.json":"./package.json"},"funding":{"url":"https://github.com/sponsors/isaacs"},"gitHead":"f738c781d14fa7bc06f8e39e062d78f701fde3f1","scripts":{"snap":"tap","test":"tap","format":"prettier --write . --log-level warn","prepare":"tshy","presnap":"npm run prepare","pretest":"npm run prepare","typedoc":"typedoc --tsconfig .tshy/esm.json ./src/*.ts","benchmark":"node benchmark/index.js","preversion":"npm test","postversion":"npm publish","prepublishOnly":"git push origin --follow-tags"},"_npmUser":{"name":"isaacs","email":"i@izs.me"},"repository":{"url":"git+ssh://git@github.com/isaacs/rimraf.git","type":"git"},"_npmVersion":"11.10.0","description":"A deep deletion module for node (like `rm -rf`)","directories":{},"_nodeVersion":"24.4.1","dependencies":{"glob":"^13.0.3","package-json-from-dist":"^1.0.1"},"_hasShrinkwrap":false,"devDependencies":{"tap":"^21.1.1","tshy":"^3.0.3","mkdirp":"^3.0.1","typedoc":"^0.28.14","prettier":"^3.6.2","@types/node":"^25.2.0"},"_npmOperationalInternal":{"tmp":"tmp/rimraf_6.1.3_1771203579407_0.09317013462008616","host":"s3://npm-registry-packages-npm-production"},"readme":"The [UNIX command](<http://en.wikipedia.org/wiki/Rm_(Unix)>) `rm -rf` for node\nin a cross-platform implementation.\n\nInstall with `npm install rimraf`.\n\n> [!CAUTION]\n>\n> ## Please Be Safe, this tool deletes and moves stuff, by design\n>\n> The _intended purpose_ of this tool is to remove files and\n> directories from the filesystem, aggressively and recursively\n> removing all items that it can find under a given target.\n>\n> It goes without saying that you _must not pass untrusted input\n> to this function or CLI tool_, just as you would not to the\n> `rm(1)` command or the `unlink(2)` function. It is very\n> challenging to guarantee that _any_ user input will be safe to\n> remove recursively in this way.\n>\n> Furthermore, note that if you allow untrusted parties to\n> provide arguments to the `rimraf` command line tool, they may\n> also specify the `--tmp=<dir>` folder used by the\n> `--impl=move-remove` strategy, which can move files to an\n> arbitrary place on disk.\n>\n> Because the intended purpose of this tool is the permanent\n> destruction of filesystem entries, any security reports that\n> rely on untrusted input being passed to the function or command\n> line tool will be rejected.\n>\n> **It is your responsibility as a user to never pass untrusted\n> user input to this module, or your system can be destroyed or\n> compromised.**\n\n## Major Changes\n\n### v5 to v6\n\n- Require node `20` or `>=22`\n- Add `--version` to CLI\n\n### v4 to v5\n\n- There is no default export anymore. Import the functions directly\n  using, e.g., `import { rimrafSync } from 'rimraf'`.\n\n### v3 to v4\n\n- The function returns a `Promise` instead of taking a callback.\n- Globbing requires the `--glob` CLI option or `glob` option property\n  to be set. (Removed in 4.0 and 4.1, opt-in support added in 4.2.)\n- Functions take arrays of paths, as well as a single path.\n- Native implementation used by default when available, except on\n  Windows, where this implementation is faster and more reliable.\n- New implementation on Windows, falling back to \"move then\n  remove\" strategy when exponential backoff for `EBUSY` fails to\n  resolve the situation.\n- Simplified implementation on POSIX, since the Windows\n  affordances are not necessary there.\n- As of 4.3, return/resolve value is boolean instead of undefined.\n\n## API\n\nHybrid module, load either with `import` or `require()`.\n\n```js\n// 'rimraf' export is the one you probably want, but other\n// strategies exported as well.\nimport { rimraf, rimrafSync, native, nativeSync } from 'rimraf'\n// or\nconst { rimraf, rimrafSync, native, nativeSync } = require('rimraf')\n```\n\nAll removal functions return a boolean indicating that all\nentries were successfully removed.\n\nThe only case in which this will not return `true` is if\nsomething was omitted from the removal via a `filter` option.\n\n### `rimraf(f, [opts]) -> Promise`\n\nThis first parameter is a path or array of paths. The second\nargument is an options object.\n\nOptions:\n\n- `preserveRoot`: If set to boolean `false`, then allow the\n  recursive removal of the root directory. Otherwise, this is\n  not allowed.\n- `tmp`: Windows only. Temp folder to place files and\n  folders for the \"move then remove\" fallback. Must be on the\n  same physical device as the path being deleted. Defaults to\n  `os.tmpdir()` when that is on the same drive letter as the path\n  being deleted, or `${drive}:\\temp` if present, or `${drive}:\\`\n  if not.\n- `maxRetries`: Windows and Native only. Maximum number of\n  retry attempts in case of `EBUSY`, `EMFILE`, and `ENFILE`\n  errors. Default `10` for Windows implementation, `0` for Native\n  implementation.\n- `backoff`: Windows only. Rate of exponential backoff for async\n  removal in case of `EBUSY`, `EMFILE`, and `ENFILE` errors.\n  Should be a number greater than 1. Default `1.2`\n- `maxBackoff`: Windows only. Maximum total backoff time in ms to\n  attempt asynchronous retries in case of `EBUSY`, `EMFILE`, and\n  `ENFILE` errors. Default `200`. With the default `1.2` backoff\n  rate, this results in 14 retries, with the final retry being\n  delayed 33ms.\n- `retryDelay`: Native only. Time to wait between retries, using\n  linear backoff. Default `100`.\n- `signal` Pass in an AbortSignal to cancel the directory\n  removal. This is useful when removing large folder structures,\n  if you'd like to limit the time spent.\n\n  Using a `signal` option prevents the use of Node's built-in\n  `fs.rm` because that implementation does not support abort\n  signals.\n\n- `glob` Boolean flag to treat path as glob pattern, or an object\n  specifying [`glob` options](https://github.com/isaacs/node-glob).\n- `filter` Method that returns a boolean indicating whether that\n  path should be deleted. With async `rimraf` methods, this may\n  return a Promise that resolves to a boolean. (Since Promises\n  are truthy, returning a Promise from a sync filter is the same\n  as just not filtering anything.)\n\n  The first argument to the filter is the path string. The\n  second argument is either a `Dirent` or `Stats` object for that\n  path. (The first path explored will be a `Stats`, the rest\n  will be `Dirent`.)\n\n  If a filter method is provided, it will _only_ remove entries\n  if the filter returns (or resolves to) a truthy value. Omitting\n  a directory will still allow its children to be removed, unless\n  they are also filtered out, but any parents of a filtered entry\n  will not be removed, since the directory will not be empty in\n  that case.\n\n  Using a filter method prevents the use of Node's built-in\n  `fs.rm` because that implementation does not support filtering.\n\nAny other options are provided to the native Node.js `fs.rm` implementation\nwhen that is used.\n\nThis will attempt to choose the best implementation, based on the Node.js\nversion and `process.platform`. To force a specific implementation, use\none of the other functions provided.\n\n### `rimraf.sync(f, [opts])` <br> `rimraf.rimrafSync(f, [opts])`\n\nSynchronous form of `rimraf()`\n\nNote that, unlike many file system operations, the synchronous form will\ntypically be significantly _slower_ than the async form, because recursive\ndeletion is extremely parallelizable.\n\n### `rimraf.native(f, [opts])`\n\nUses the built-in `fs.rm` implementation that Node.js provides. This is\nused by default on Node.js versions greater than or equal to `14.14.0`.\n\n### `rimraf.native.sync(f, [opts])` <br> `rimraf.nativeSync(f, [opts])`\n\nSynchronous form of `rimraf.native`\n\n### `rimraf.manual(f, [opts])`\n\nUse the JavaScript implementation appropriate for your operating system.\n\n### `rimraf.manual.sync(f, [opts])` <br> `rimraf.manualSync(f, opts)`\n\nSynchronous form of `rimraf.manual()`\n\n### `rimraf.windows(f, [opts])`\n\nJavaScript implementation of file removal appropriate for Windows\nplatforms. Works around `unlink` and `rmdir` not being atomic\noperations, and `EPERM` when deleting files with certain\npermission modes.\n\nFirst deletes all non-directory files within the tree, and then\nremoves all directories, which should ideally be empty by that\ntime. When an `ENOTEMPTY` is raised in the second pass, falls\nback to the `rimraf.moveRemove` strategy as needed.\n\n### `rimraf.windows.sync(path, [opts])` <br> `rimraf.windowsSync(path, [opts])`\n\nSynchronous form of `rimraf.windows()`\n\n### `rimraf.moveRemove(path, [opts])`\n\nMoves all files and folders to the parent directory of `path`\nwith a temporary filename prior to attempting to remove them.\n\nNote that, in cases where the operation fails, this _may_ leave\nfiles lying around in the parent directory with names like\n`.file-basename.txt.0.123412341`. Until the Windows kernel\nprovides a way to perform atomic `unlink` and `rmdir` operations,\nthis is, unfortunately, unavoidable.\n\nTo move files to a different temporary directory other than the\nparent, provide `opts.tmp`. Note that this _must_ be on the same\nphysical device as the folder being deleted, or else the\noperation will fail.\n\nThis is the slowest strategy, but most reliable on Windows\nplatforms. Used as a last-ditch fallback by `rimraf.windows()`.\n\n### `rimraf.moveRemove.sync(path, [opts])` <br> `rimraf.moveRemoveSync(path, [opts])`\n\nSynchronous form of `rimraf.moveRemove()`\n\n### Command Line Interface\n\n```\nrimraf version 6.0.1\n\nUsage: rimraf <path> [<path> ...]\nDeletes all files and folders at \"path\", recursively.\n\nOptions:\n  --                   Treat all subsequent arguments as paths\n  -h --help            Display this usage info\n  --version            Display version\n  --preserve-root      Do not remove '/' recursively (default)\n  --no-preserve-root   Do not treat '/' specially\n  -G --no-glob         Treat arguments as literal paths, not globs (default)\n  -g --glob            Treat arguments as glob patterns\n  -v --verbose         Be verbose when deleting files, showing them as\n                       they are removed. Not compatible with --impl=native\n  -V --no-verbose      Be silent when deleting files, showing nothing as\n                       they are removed (default)\n  -i --interactive     Ask for confirmation before deleting anything\n                       Not compatible with --impl=native\n  -I --no-interactive  Do not ask for confirmation before deleting\n\n  --impl=<type>        Specify the implementation to use:\n                       rimraf: choose the best option (default)\n                       native: the built-in implementation in Node.js\n                       manual: the platform-specific JS implementation\n                       posix: the Posix JS implementation\n                       windows: the Windows JS implementation (falls back to\n                                move-remove on ENOTEMPTY)\n                       move-remove: a slow reliable Windows fallback\n\nImplementation-specific options:\n  --tmp=<path>        Temp file folder for 'move-remove' implementation\n  --max-retries=<n>   maxRetries for 'native' and 'windows' implementations\n  --retry-delay=<n>   retryDelay for 'native' implementation, default 100\n  --backoff=<n>       Exponential backoff factor for retries (default: 1.2)\n```\n\n## mkdirp\n\nIf you need to _create_ a directory recursively, check out\n[mkdirp](https://github.com/isaacs/node-mkdirp).\n","publish_time":1771203579538,"_cnpm_publish_time":1771203579538,"dist-tags":{"latest":"6.1.4","v5-legacy":"5.0.10"}}