# force-del

> Force delete files or folders using globs

Latest version **2.0.0** (published 2018-03-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install force-del
pnpm add force-del
yarn add force-del
bun add force-del
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-03-23 |
| First published | 2018-01-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 4 |
| Unpacked size | 7.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Lufty Wiranda |
| Maintainers | luftywiranda13 |
| Keywords | clean, cleaning, cleanup, del, delete, destroy, dir, directories, directory, file, files, filesystem, folder, folders, fs, glob, gulpfriendly, remove, rimraf, rm, rmdir, rmrf, trash, unlink |

## Links

- npm: https://www.npmjs.com/package/force-del
- Repository: https://github.com/luftywiranda13/force-del
- Homepage: https://github.com/luftywiranda13/force-del#readme
- Issues: https://github.com/luftywiranda13/force-del/issues
- npm.io page: https://npm.io/package/force-del

## Dependencies (4)

- [execa](https://npm.io/package/execa.md) ^0.10.0
- [p-map](https://npm.io/package/p-map.md) ^1.2.0
- [globby](https://npm.io/package/globby.md) ^8.0.1
- [rimraf](https://npm.io/package/rimraf.md) ^2.6.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-03-23
- 1.4.1 — 2018-01-20
- 1.4.0 — 2018-01-18
- 1.3.0 — 2018-01-17
- 1.2.0 — 2018-01-16
- 1.1.0 — 2018-01-16
- 1.0.3 — 2018-01-14
- 1.0.2 — 2018-01-12
- 1.0.1 — 2018-01-12
- 1.0.0 — 2018-01-11

## README

# force-del

> Force delete files or folders using [globs](https://github.com/isaacs/minimatch#usage)

[![Package Version](https://img.shields.io/npm/v/force-del.svg?style=flat-square)](https://www.npmjs.com/package/force-del)
[![Downloads Status](https://img.shields.io/npm/dm/force-del.svg?style=flat-square)](https://npm-stat.com/charts.html?package=force-del&from=2016-04-01)
[![Build Status: Linux](https://img.shields.io/travis/luftywiranda13/force-del/master.svg?style=flat-square)](https://travis-ci.org/luftywiranda13/force-del)
[![Coverage Status](https://img.shields.io/codecov/c/github/luftywiranda13/force-del/master.svg?style=flat-square)](https://codecov.io/gh/luftywiranda13/force-del)

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](https://github.com/sindresorhus/globby)
* Maps the matching paths _one-by-one_ to be included in `git rm -rf` command
* Uses [rimraf](https://github.com/isaacs/rimraf) if the matching item isnʼt managed by `git`
* These processes run concurrently

## Installation

```sh
npm install force-del
```

## Usage

```js
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](https://github.com/isaacs/minimatch#usage).

* [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js)
* [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns)

#### options

Type: `Object`

##### concurrency

Type: `number`<br>
Default: `Infinity`<br>
Minimum: `1`

Concurrency limit.

##### cwd

Type: `string`<br />
Default: `process.cwd()`

Current working directory.

##### onlyFiles

Type: `boolean`<br />
Default: `false`

Set to `true` to match files only.

Other options are derived from the defaults of these libraries:

* [globby](https://github.com/sindresorhus/globby#options)
* [node-glob](https://github.com/isaacs/node-glob#options)
* [execa](https://github.com/sindresorhus/execa/#options)

## Related

* [force-del-cli](https://github.com/luftywiranda13/force-del-cli) － CLI for this module
* [remove-lockfiles](https://github.com/luftywiranda13/remove-lockfiles) － Prevent committing lockfiles

## License

MIT &copy; [Lufty Wiranda](https://www.luftywiranda.com)

---
_Source: https://npm.io/package/force-del · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
