npm.io
1.0.12 • Published 10 years ago

retention-guard

Licence
ISC
Version
1.0.12
Deps
3
Vulns
0
Weekly
0

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

Keywords