# delete

> Delete files and folders and any intermediate directories if they exist (sync and async).

Latest version **1.1.0** (published 2017-07-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install delete
pnpm add delete
yarn add delete
bun add delete
```

## 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 | 1.1.0 |
| Published | 2017-07-02 |
| First published | 2014-06-28 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.12.0 |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 24 |
| Author | Jon Schlinkert |
| Maintainers | jonschlinkert |
| Keywords | check, clean, cleaning, cleanup, cwd, del, delete, destroy, dir, directory, file, filepath, files, filesystem, folder, fs, glob, inside, path, pwd, relative, remove, rimraf, rm, rmdir, rmrf, trash, unlink |

## Links

- npm: https://www.npmjs.com/package/delete
- Repository: https://github.com/jonschlinkert/delete
- Issues: https://github.com/jonschlinkert/delete/issues
- npm.io page: https://npm.io/package/delete

## Dependencies (4)

- [rimraf](https://npm.io/package/rimraf.md) ^2.6.1
- [matched](https://npm.io/package/matched.md) ^1.0.2
- [async-each](https://npm.io/package/async-each.md) ^1.0.1
- [extend-shallow](https://npm.io/package/extend-shallow.md) ^2.0.1

## 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

- 1.1.0 (latest) — 2017-07-02
- 1.0.1 — 2017-05-15
- 1.0.0 — 2017-05-15
- 0.3.2 — 2016-05-03
- 0.3.1 — 2016-04-27
- 0.3.0 — 2015-12-28
- 0.2.1 — 2015-07-18
- 0.2.0 — 2015-07-09
- 0.1.5 — 2014-09-22
- 0.1.4 — 2014-06-28
- 0.1.3 — 2014-06-28
- 0.1.2 — 2014-06-28
- 0.1.1 — 2014-06-28
- 0.1.0 — 2014-06-28

## README

# delete [![NPM version](https://img.shields.io/npm/v/delete.svg?style=flat)](https://www.npmjs.com/package/delete) [![NPM monthly downloads](https://img.shields.io/npm/dm/delete.svg?style=flat)](https://npmjs.org/package/delete) [![NPM total downloads](https://img.shields.io/npm/dt/delete.svg?style=flat)](https://npmjs.org/package/delete) [![Linux Build Status](https://img.shields.io/travis/jonschlinkert/delete.svg?style=flat&label=Travis)](https://travis-ci.org/jonschlinkert/delete)

> Delete files and folders and any intermediate directories if they exist (sync and async).

## Install

Install with [npm](https://www.npmjs.com/):

```sh
$ npm install --save delete
```

## Usage

```js
var del = require('delete');

// async
del(['foo/*.js'], function(err, deleted) {
  if (err) throw err;
  // deleted files
  console.log(deleted);
});

// sync
del.sync(['foo/*.js']);

// promise
del.promise(['foo/*.js'])
  .then(function(deleted) {
    // deleted files
    console.log(deleted)
  });
```

## Options

All methods take an `options` object as the second argument.

### options.force

**Type**: `boolean`

**Default**: `undefined`

By default, error is thrown if you try to delete either the current working directory itself, or files outside of the current working directory (e.g. parent directories).

**Examples**

```js
del.sync('../foo.md', {force: true});

del('.', {force: true}, function(err, files) {
  // do stuff with err
  console.log(files);
});

del.promise('./', {force: true})
  .then(function(files) {
    console.log(files);
  })
```

_(This option was inspired by settings in [grunt](http://gruntjs.com/).)_

## About

### Related projects

* [copy](https://www.npmjs.com/package/copy): Copy files or directories using globs. | [homepage](https://github.com/jonschlinkert/copy "Copy files or directories using globs.")
* [export-files](https://www.npmjs.com/package/export-files): node.js utility for exporting a directory of files as modules. | [homepage](https://github.com/jonschlinkert/export-files "node.js utility for exporting a directory of files as modules.")
* [micromatch](https://www.npmjs.com/package/micromatch): Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch. | [homepage](https://github.com/micromatch/micromatch "Glob matching for javascript/node.js. A drop-in replacement and faster alternative to minimatch and multimatch.")
* [write](https://www.npmjs.com/package/write): Write files to disk, creating intermediate directories if they don't exist. | [homepage](https://github.com/jonschlinkert/write "Write files to disk, creating intermediate directories if they don't exist.")

### Contributing

Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).

### Building docs

_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_

To generate the readme, run the following command:

```sh
$ npm install -g verbose/verb#dev verb-generate-readme && verb
```

### Running tests

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

```sh
$ npm install && npm test
```

### Author

**Jon Schlinkert**

* [github/jonschlinkert](https://github.com/jonschlinkert)
* [twitter/jonschlinkert](https://twitter.com/jonschlinkert)

### License

Copyright © 2017, [Jon Schlinkert](https://github.com/jonschlinkert).
Released under the [MIT License](LICENSE).

***

_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on July 02, 2017._

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