Package Exports
- force-del
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (force-del) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
force-del
Force delete files or folders using globs
If the matching files or folders are managed by git
, theyʼll be deleted and marked as deleted
in staging area. Otherwise, theyʼll be deleted permanently (not to the trash).
How does it work?
- Filters the files that should be deleted by using globby
- Maps the matching paths one-by-one to be included in
git rm -rf
command - Uses rimraf if the matching item isnʼt managed by
git
- These processes run concurrently
Installation
npm install force-del
Usage
const forceDel = require('force-del');
forceDel(['**/*.{gif,jpg}', 'oops/vids/*.3gp']).then(paths => {
console.log('Deleted:\n', paths.join('\n'));
});
API
forceDel(patterns, [options])
Returns Promise<Array>
of deleted paths.
patterns
Type: string
| string[]
See supported minimatch patterns.
options
Type: Object
concurrency
Type: number
Default: Infinity
Minimum: 1
Concurrency limit.
cwd
Type: string
Default: process.cwd()
Current working directory.
onlyFiles
Type: boolean
Default: false
Set to true
to match files only.
Other options are derived from the defaults of these libraries:
Related
- force-del-cli - CLI for this module
- remove-lockfiles - Prevent committing lockfiles
License
MIT © Lufty Wiranda