{
 "kind": "tool",
 "slug": "rimraf",
 "path": "tools/rimraf/",
 "name": "rimraf",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Dev workflow and config",
   "tools/dev-workflow/"
  ]
 ],
 "lead": "Delete folders the same way on every system.",
 "chips": [
  {
   "label": "Dev workflow and config",
   "path": "tools/dev-workflow/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install rimraf"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/isaacs/rimraf"
  },
  {
   "label": "Website",
   "href": "https://github.com/isaacs/rimraf#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "BlueOak-1.0.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "Each contributor licenses you to do everything with this software that would otherwise infringe that contributor's copyright in it.",
   "note": "Blue Oak 1.0.0 allows any use, including paid and closed products.",
   "src": "https://github.com/isaacs/rimraf/blob/main/LICENSE.md"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 3, 2026",
   "note": "",
   "src": "https://github.com/isaacs/rimraf"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "161 projects",
   "status": "info",
   "sub": "#12 of 299 in its category",
   "note": "Dependency in 161 public GitHub projects set up for AI coding agents that we scanned (2.6%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 11, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What rimraf does",
   "parts": [
    {
     "t": "prose",
     "text": "rimraf is a small free JavaScript package that deletes files and whole folders, like the rm -rf command, and works the same on Windows, Mac and Linux. Projects use it to wipe build output or caches before a fresh build. What it deletes is gone for good; it does not use the trash."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Wipe the build folder first",
       "text": "Before each build, old files in dist are removed so nothing stale gets shipped. One line in the scripts section of package.json does it.",
       "idea": true
      },
      {
       "title": "Same delete command on every computer",
       "text": "Teammates on Windows and on Mac run the same clean script; rm -rf alone would fail on a plain Windows shell.",
       "idea": false
      },
      {
       "title": "Delete files by pattern",
       "text": "Remove every .log or .map file under a folder in one call instead of listing each one.",
       "idea": false
      },
      {
       "title": "Clear a cache but keep a marker file",
       "text": "Empty a cache folder while keeping the .gitkeep file that keeps the folder in git.",
       "idea": false
      },
      {
       "title": "Stop a huge delete on time",
       "text": "A cleanup job deletes a very large folder but must give up after a set time instead of blocking everything.",
       "idea": false
      },
      {
       "title": "Remove test leftovers",
       "text": "After a test run, delete the temporary folders the tests created so the next run starts clean.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "rimraf popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "74",
       "of": "/ 100",
       "l": "Gid Score, #248 overall"
      },
      {
       "n": "216M",
       "l": "downloads a week, npm"
      },
      {
       "n": "5,859",
       "l": "GitHub stars"
      },
      {
       "n": "161",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How rimraf is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "rimraf is a dependency in 161 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (3.3% of the 4,867 JavaScript/TypeScript ones), #12 of 299 in dev workflow and config.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 457; those are left out of every share on this page.",
      "Projects that use it most often also use TypeScript (88.2%), ESLint (66.5%), Prettier (49.7%).",
      "It is more common in projects set up for OpenAI Codex (4.7%) than for OpenCode (1.7%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "88 projects, 2.7%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "81 projects, 2.7%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "62 projects, 2.5%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "22 projects, 4.7%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "14 projects, 3.0%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "8 projects, 2.9%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "6 projects, 1.7%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "5 projects, 3.6%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 88.2% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 66.5% of its projects",
       "v": "ESLint",
       "path": "tools/eslint/"
      },
      {
       "l": "In 49.7% of its projects",
       "v": "Prettier",
       "path": "tools/prettier/"
      },
      {
       "l": "In 32.9% of its projects",
       "v": "Husky",
       "path": "tools/husky/"
      },
      {
       "l": "In 28.0% of its projects",
       "v": "lint-staged",
       "path": "tools/lint-staged/"
      },
      {
       "l": "In 42.2% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 21.1% of its projects",
       "v": "cross-env",
       "path": "tools/cross-env/"
      },
      {
       "l": "In 33.5% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about rimraf",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Funding",
       "path": "tools/funding/",
       "items": [
        "GitHub Sponsors: https://github.com/isaacs",
        "23 GitHub sponsors"
       ]
      },
      {
       "title": "More in Dev workflow and config",
       "path": "tools/dev-workflow/",
       "items": [
        {
         "text": "dotenv",
         "path": "tools/dotenv/"
        },
        {
         "text": "Husky",
         "path": "tools/husky/"
        },
        {
         "text": "python-dotenv",
         "path": "tools/python-dotenv/"
        },
        {
         "text": "lint-staged",
         "path": "tools/lint-staged/"
        },
        {
         "text": "concurrently",
         "path": "tools/concurrently/"
        },
        {
         "text": "Rich",
         "path": "tools/rich/"
        },
        {
         "text": "Pydantic Settings",
         "path": "tools/pydantic-settings/"
        },
        {
         "text": "cross-env",
         "path": "tools/cross-env/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "rimraf",
       "me": true,
       "facts": [
        "BlueOak-1.0.0",
        "Gid 74",
        "216M/wk"
       ]
      },
      {
       "name": "del",
       "why": "Pick del when you want to delete by glob patterns as the normal way of working, from Node.js code.",
       "path": "tools/del/",
       "facts": []
      },
      {
       "name": "shx",
       "why": "Pick shx when your scripts need several shell commands (copy, move, make folders), not just delete.",
       "path": "tools/shx/",
       "facts": []
      },
      {
       "name": "fs-extra",
       "why": "Pick fs-extra when your code also copies and creates folders and you want one helper package for all of it.",
       "path": "tools/fs-extra/",
       "facts": []
      }
     ],
     "more": "Compare rimraf with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add rimraf 6.1.4 (Node 20 or 22+) as a dev dependency, use \"rimraf dist\" in a prebuild script, and in code use import { rimraf } from \"rimraf\" with await; never pass user input to it."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add it to the project.",
       "code": "npm install rimraf",
       "src": "https://github.com/isaacs/rimraf/blob/main/README.md"
      },
      {
       "text": "Import the function by name and await it with a path or a list of paths.",
       "code": "import { rimraf, rimrafSync, native, nativeSync } from 'rimraf'",
       "src": "https://github.com/isaacs/rimraf/blob/main/README.md"
      },
      {
       "text": "Or call the command in a package.json script.",
       "code": "rimraf <path> [<path> ...]",
       "src": "https://github.com/isaacs/rimraf/blob/main/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "import rimraf from 'rimraf'  or  const rimraf = require('rimraf')",
       "fix": "import { rimraf } from 'rimraf'  or  const { rimraf } = require('rimraf')",
       "why": "Since version 5 there is no default export; code from old tutorials fails with 'not a function'."
      },
      {
       "dont": "rimraf('dist', (err) => { ... })",
       "fix": "await rimraf('dist')",
       "why": "Since version 4 the function returns a Promise and takes no callback."
      },
      {
       "dont": "rimraf('dist/**/*.map')  expecting a pattern match",
       "fix": "rimraf('dist/**/*.map', { glob: true })  or  rimraf --glob 'dist/**/*.map'",
       "why": "Without the glob option the string is treated as one literal path."
      },
      {
       "dont": "await rimraf(req.body.folder)",
       "fix": "Build the path yourself from a fixed base folder and an id you checked; never pass raw user input",
       "why": "The README says reports that rely on untrusted input will be rejected; the risk is on you."
      },
      {
       "dont": "\"rimraf\": \"^3.0.2\" in package.json",
       "fix": "\"rimraf\": \"^6.1.4\" (Node 20 or 22+), or 5.x for older Node",
       "why": "npm marks every version before 4 as no longer supported."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Does it put files in the trash?",
       "a": "No. It deletes them for good; its purpose is permanent removal.",
       "evidence": {
        "url": "https://github.com/isaacs/rimraf/blob/main/README.md",
        "quote": "Because the intended purpose of this tool is the permanent destruction of filesystem entries"
       }
      },
      {
       "q": "Why does rimraf('*.log') not delete my log files?",
       "a": "Patterns are off by default. Pass { glob: true } in code or --glob on the command line.",
       "evidence": {
        "url": "https://github.com/isaacs/rimraf/blob/main/README.md",
        "quote": "Globbing requires the --glob CLI option or glob option property to be set."
       }
      },
      {
       "q": "What does it return?",
       "a": "true when everything was removed; false only when a filter kept something. A missing path also gave true in our run.",
       "evidence": {
        "url": "https://github.com/isaacs/rimraf/blob/main/README.md",
        "quote": "The only case in which this will not return true is if something was omitted from the removal via a filter option."
       }
      },
      {
       "q": "Is the sync version faster?",
       "a": "Usually not. The README says the synchronous form is typically much slower than the async one.",
       "evidence": {
        "url": "https://github.com/isaacs/rimraf/blob/main/README.md",
        "quote": "the synchronous form will typically be significantly slower than the async form, because recursive deletion is extremely parallelizable."
       }
      },
      {
       "q": "Can it delete the root folder by mistake?",
       "a": "Not by default: removing / is refused unless you pass --no-preserve-root or preserveRoot: false.",
       "evidence": {
        "url": "https://github.com/isaacs/rimraf/blob/main/README.md",
        "quote": "Do not remove '/' recursively (default)"
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm rimraf"
  ],
  [
   "Category",
   "Dev workflow and config"
  ],
  [
   "License",
   "BlueOak-1.0.0"
  ],
  [
   "Gid Score",
   "73.6"
  ],
  [
   "Rank in category",
   "#12 of 299"
  ],
  [
   "GitHub",
   "isaacs/rimraf"
  ],
  [
   "Last change",
   "Nov 3, 2026"
  ]
 ],
 "good": [
  "Never give it a path typed by a user or taken from a request. A wrong path can wipe important folders.",
  "Version 6 needs Node.js 20 or 22 and newer.",
  "Versions before 4 are marked unsupported, and some early 4.x versions had a symbolic link problem; use 6.x."
 ],
 "checked_line": "Read by AgentGid from 4 official pages, card checked Nov 11, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/isaacs.png"
}