# delete-files

> Asynchronously find and delete files in a folder

Latest version **0.1.0** (published 2019-04-25) · MIT license · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2019-04-25 |
| First published | 2019-04-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 15.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | James Knight |
| Maintainers | knightjdr |

## Links

- npm: https://www.npmjs.com/package/delete-files
- Repository: https://github.com/knightjdr/delete-files
- Homepage: https://github.com/knightjdr/delete-files#readme
- Issues: https://github.com/knightjdr/delete-files/issues
- npm.io page: https://npm.io/package/delete-files

## Dependencies (1)

- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1

## Recent versions

- 0.1.0 (latest) — 2019-04-25

## README

# Delete files

Asynchronously delete files in node.

## Install

### Yarn
```
yarn add delete-files
```

### NPM
```
npm install delete-files --save 
```

## Usage

```
deleteFiles(<folder>, [options]);
```

### Example

Remove all files/folders in `/dir` beginning with `tmp` that are older than a day (age is specified in seconds).

```
const deleteFiles = require('delete-files');

const options = {
  age: 86400,
  glob: '^tmp',
};

deleteFiles('/dir', options);
```

If a glob is specified and a file does not match, no further options will be checked and the file will not
be removed.

## Implementation

The path for the directory to search must be specified with the full path. The age of a file is determined from the `mtime` (last modified). Files and folders are removed with the fs-extra `remove` function which is the equivalent of `rm -rf`.

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