{"name":"del","version":"8.0.0","description":"Delete files and directories","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/del.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsd","bench":"node benchmark.js"},"keywords":["delete","files","folders","directories","remove","destroy","trash","unlink","clean","cleaning","cleanup","rm","rmrf","rimraf","rmdir","glob","gulpfriendly","file","folder","directory","fs","filesystem"],"dependencies":{"globby":"^14.0.2","is-glob":"^4.0.3","is-path-cwd":"^3.0.0","is-path-inside":"^4.0.0","p-map":"^7.0.2","slash":"^5.1.0"},"devDependencies":{"ava":"^6.1.3","benchmark":"^2.1.4","tempy":"^3.1.0","tsd":"^0.31.2","xo":"^0.59.3"},"ava":{"serial":true,"workerThreads":false},"_id":"del@8.0.0","gitHead":"51344d2ec4efece380768c44f3cc74f2b2c06590","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/del/issues"},"homepage":"https://github.com/sindresorhus/del#readme","_nodeVersion":"22.6.0","_npmVersion":"10.6.0","dist":{"integrity":"sha512-R6ep6JJ+eOBZsBr9esiNN1gxFbZE4Q2cULkUSFumGYecAiS6qodDvcPx/sFuWHMNul7DWmrtoEOpYSm7o6tbSA==","shasum":"f333a5673cfeb72e46084031714a7c30515e80aa","tarball":"http://registry-npm.ywwl.com/del/download/del-8.0.0.tgz","fileCount":5,"unpackedSize":12624,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDB2xtBgPWVAHWqO9QEaMz7F9IpRE6fdQdxngL7IelAgwIgDi2Wxj3PxyPU5u7XpmFoZHZT2FkpDfDFJbhLVn8he+8="}],"size":4061,"noattachment":false,"key":"/del/-/del-8.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/del_8.0.0_1728276934724_0.35088132554181617"},"_hasShrinkwrap":false,"readme":"# del\n\n> Delete files and directories using [globs](https://github.com/sindresorhus/globby#globbing-patterns)\n\nSimilar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API and support for multiple files and globbing. It also protects you against deleting the current working directory and above.\n\n## Install\n\n```sh\nnpm install del\n```\n\n## Usage\n\n```js\nimport {deleteAsync} from 'del';\n\nconst deletedFilePaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']);\nconst deletedDirectoryPaths = await deleteAsync(['temp', 'public']);\n\nconsole.log('Deleted files:\\n', deletedFilePaths.join('\\n'));\nconsole.log('\\n\\n');\nconsole.log('Deleted directories:\\n', deletedDirectoryPaths.join('\\n'));\n```\n\n## Beware\n\nThe glob pattern `**` matches all children and *the parent*.\n\nSo this won't work:\n\n```js\ndeleteSync(['public/assets/**', '!public/assets/goat.png']);\n```\n\nYou have to explicitly ignore the parent directories too:\n\n```js\ndeleteSync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);\n```\n\nTo delete all subdirectories inside `public/`, you can do:\n\n```js\ndeleteSync(['public/*/']);\n```\n\nSuggestions on how to improve this welcome!\n\n## API\n\nNote that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`.\n\n### deleteAsync(patterns, options?)\n\nReturns `Promise<string[]>` with the deleted paths.\n\n### deleteSync(patterns, options?)\n\nReturns `string[]` with the deleted paths.\n\n#### patterns\n\nType: `string | string[]`\n\nSee the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns).\n\n- [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/main/test/test.js)\n- [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)\n\n#### options\n\nType: `object`\n\nYou can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the below options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default.\n\n##### force\n\nType: `boolean`\\\nDefault: `false`\n\nAllow deleting the current working directory and outside.\n\n##### dryRun\n\nType: `boolean`\\\nDefault: `false`\n\nSee what would be deleted.\n\n```js\nimport {deleteAsync} from 'del';\n\nconst deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true});\n\nconsole.log('Files and directories that would be deleted:\\n', deletedPaths.join('\\n'));\n```\n\n##### dot\n\nType: `boolean`\\\nDefault: `false`\n\nAllow patterns to match files/folders that start with a period (`.`).\n\nThis option is passed through to [`fast-glob`](https://github.com/mrmlnc/fast-glob#dot).\n\nNote that an explicit dot in a portion of the pattern will always match dot files.\n\n**Example**\n\n```\ndirectory/\n├── .editorconfig\n└── package.json\n```\n\n```js\nimport {deleteSync} from 'del';\n\ndeleteSync('*', {dot: false});\n//=> ['package.json']\ndeleteSync('*', {dot: true});\n//=> ['.editorconfig', 'package.json']\n```\n\n##### concurrency\n\nType: `number`\\\nDefault: `Infinity`\\\nMinimum: `1`\n\nConcurrency limit.\n\n##### onProgress\n\nType: `(progress: ProgressData) => void`\n\nCalled after each file or directory is deleted.\n\n```js\nimport {deleteAsync} from 'del';\n\nawait deleteAsync(patterns, {\n\tonProgress: progress => {\n\t// …\n}});\n```\n\n###### ProgressData\n\n```js\n{\n\ttotalCount: number,\n\tdeletedCount: number,\n\tpercent: number,\n\tpath?: string\n}\n```\n\n- `percent` is a value between `0` and `1`\n- `path` is the absolute path of the deleted file or directory. It will not be present if nothing was deleted.\n\n## CLI\n\nSee [del-cli](https://github.com/sindresorhus/del-cli) for a CLI for this module and [trash-cli](https://github.com/sindresorhus/trash-cli) for a safe version that is suitable for running by hand.\n\n## Related\n\n- [make-dir](https://github.com/sindresorhus/make-dir) - Make a directory and its parents if needed\n- [globby](https://github.com/sindresorhus/globby) - User-friendly glob matching\n","publish_time":1728276934922,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1728276934922,"dist-tags":{"latest":"9.0.1"}}