{"id":712,"url":"https://github.com/isaacs/rimraf","last_synced_at":"2026-10-18T23:45:19.262Z","repository":{"id":39460563,"uuid":"1341324","full_name":"isaacs/rimraf","owner":"isaacs","description":"A `rm -rf` util for nodejs","archived":false,"fork":false,"pushed_at":"2026-05-15T19:38:06.000Z","size":798,"stargazers_count":5854,"open_issues_count":11,"forks_count":265,"subscribers_count":38,"default_branch":"main","last_synced_at":"2026-10-17T16:01:29.978Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"blueoak-1.0.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/isaacs.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["isaacs"]}},"created_at":"2011-02-08T08:58:20.000Z","updated_at":"2026-10-16T03:28:31.000Z","dependencies_parsed_at":"2023-02-10T19:30:16.979Z","dependency_job_id":"9a109e0a-7ba9-4bce-b799-f817dc124c2d","html_url":"https://github.com/isaacs/rimraf","commit_stats":{"total_commits":316,"total_committers":33,"mean_commits":9.575757575757576,"dds":0.129746835443038,"last_synced_commit":"8733d4c30078a1ae5f18bb6affe83c1eea0259b4"},"previous_names":[],"tags_count":85,"template":false,"template_full_name":null,"purl":"pkg:github/isaacs/rimraf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacs%2Frimraf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacs%2Frimraf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacs%2Frimraf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacs%2Frimraf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/isaacs","download_url":"https://codeload.github.com/isaacs/rimraf/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/isaacs%2Frimraf/sbom","scorecard":{"id":495040,"data":{"date":"2025-08-11","repo":{"name":"github.com/isaacs/rimraf","commit":"8733d4c30078a1ae5f18bb6affe83c1eea0259b4"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3.2,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":1,"reason":"Found 3/30 approved changesets -- score normalized to 1","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/benchmark.yml:1","Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Info: topLevel 'contents' permission set to 'read': .github/workflows/typedoc.yml:14","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/benchmark.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/benchmark.yml:26: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/benchmark.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:28: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:31: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/typedoc.yml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/typedoc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/typedoc.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/typedoc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/typedoc.yml:43: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/typedoc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/typedoc.yml:45: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/typedoc.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/typedoc.yml:50: update your workflow using https://app.stepsecurity.io/secureworkflow/isaacs/rimraf/typedoc.yml/main?enable=pin","Warn: npmCommand not pinned by hash: .github/workflows/benchmark.yml:32","Warn: npmCommand not pinned by hash: .github/workflows/typedoc.yml:39","Info:   0 out of   9 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   2 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: ISC License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":7,"reason":"3 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-x7hr-w5r2-h6wg"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T20:15:43.650Z","repository_id":39460563,"created_at":"2025-08-19T20:15:43.651Z","updated_at":"2025-08-19T20:15:43.651Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344872684,"owners_count":38335129,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-17T02:00:06.547Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-01-05T20:15:29.424Z","updated_at":"2026-10-18T23:45:19.256Z","avatar_url":"https://github.com/isaacs.png","language":"TypeScript","funding_links":["https://github.com/sponsors/isaacs"],"categories":["Node","命令行","目录","[Node.js](http://nodejs.org/) feature module and bundler","Packages","TypeScript","Applications","Repository","others","包","Uncategorized","脚手架以及工具包","JavaScript","📦 Modules/Packages","GIT 仓库","第三方库介绍","文件","Filesystem","模块","Cross-platform Utilities","Modules","Libraries","Node.js","📄 File System \u0026 Uploads"],"sub_categories":["文件处理","redux 扩展","文件系统","Filesystem","Utilities","Uncategorized","macros",":curly_loop: Typography","文件管理","File System","E2E Testing"],"readme":"The [UNIX command](\u003chttp://en.wikipedia.org/wiki/Rm_(Unix)\u003e) `rm -rf` for node\nin a cross-platform implementation.\n\nInstall with `npm install rimraf`.\n\n\u003e [!CAUTION]\n\u003e\n\u003e ## Please Be Safe, this tool deletes and moves stuff, by design\n\u003e\n\u003e The _intended purpose_ of this tool is to remove files and\n\u003e directories from the filesystem, aggressively and recursively\n\u003e removing all items that it can find under a given target.\n\u003e\n\u003e It goes without saying that you _must not pass untrusted input\n\u003e to this function or CLI tool_, just as you would not to the\n\u003e `rm(1)` command or the `unlink(2)` function. It is very\n\u003e challenging to guarantee that _any_ user input will be safe to\n\u003e remove recursively in this way.\n\u003e\n\u003e Furthermore, note that if you allow untrusted parties to\n\u003e provide arguments to the `rimraf` command line tool, they may\n\u003e also specify the `--tmp=\u003cdir\u003e` folder used by the\n\u003e `--impl=move-remove` strategy, which can move files to an\n\u003e arbitrary place on disk.\n\u003e\n\u003e Because the intended purpose of this tool is the permanent\n\u003e destruction of filesystem entries, any security reports that\n\u003e rely on untrusted input being passed to the function or command\n\u003e line tool will be rejected.\n\u003e\n\u003e **It is your responsibility as a user to never pass untrusted\n\u003e user input to this module, or your system can be destroyed or\n\u003e compromised.**\n\n## Major Changes\n\n### v5 to v6\n\n- Require node `20` or `\u003e=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]) -\u003e 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])` \u003cbr\u003e `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])` \u003cbr\u003e `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])` \u003cbr\u003e `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])` \u003cbr\u003e `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])` \u003cbr\u003e `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 \u003cpath\u003e [\u003cpath\u003e ...]\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=\u003ctype\u003e        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=\u003cpath\u003e        Temp file folder for 'move-remove' implementation\n  --max-retries=\u003cn\u003e   maxRetries for 'native' and 'windows' implementations\n  --retry-delay=\u003cn\u003e   retryDelay for 'native' implementation, default 100\n  --backoff=\u003cn\u003e       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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacs%2Frimraf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fisaacs%2Frimraf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fisaacs%2Frimraf/lists"}