# retention-guard

> Enforce a retention policy for a folder

Latest version **1.0.12** (published 2016-06-06) · ISC license · 0 weekly downloads

## Install

```sh
npm install retention-guard
pnpm add retention-guard
yarn add retention-guard
bun add retention-guard
```

## 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.0.12 |
| Published | 2016-06-06 |
| First published | 2015-11-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Kedem Diamant |
| Maintainers | kedem |
| Keywords | retention, policy, folder, fs, limit, size, age |

## Links

- npm: https://www.npmjs.com/package/retention-guard
- Repository: https://github.com/kedemd/retention-guard
- Issues: https://github.com/kedemd/retention-guard/issues
- npm.io page: https://npm.io/package/retention-guard

## Dependencies (3)

- [async](https://npm.io/package/async.md) ^1.5.0
- [chokidar](https://npm.io/package/chokidar.md) ^1.2.0
- [diskusage](https://npm.io/package/diskusage.md) ^0.1.5

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.0.12 (latest) — 2016-06-06
- 1.0.11 — 2016-03-21
- 1.0.10 — 2016-03-16
- 1.0.9 — 2016-03-16
- 1.0.8 — 2015-11-23
- 1.0.7 — 2015-11-23
- 1.0.6 — 2015-11-23
- 1.0.5 — 2015-11-23
- 1.0.4 — 2015-11-23
- 1.0.3 — 2015-11-23
- 1.0.2 — 2015-11-23
- 1.0.1 — 2015-11-16
- 1.0.0 — 2015-11-16

## README

# retention-guard
Enforces limits on a folder

Retention guard use chokidar library to efficiently calculate the size of the folder and apply retention rules.

##Basic Usage

Retention guard will automatically delete old files to create room for new files.


    var RetentionGuard = require('retention-guard');

    var guard = new RetentionGuard('/path-to-dir', {
        expiresIn: 1000 * 60 * 60 * 24, // Delete files that are older than 24 hours
        maxSize: 1024 * 1024 * 500 // Delete files when folder size exeeds 500mb
    });

    guard.start();

    // guard.size <- current directory size

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