2.0.0 • Published 9 years ago

fs-reap v2.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

reap

NPM version Build status Test coverage Dependency Status License Downloads Gittip

Delete files in a directory based on last accessed or last modified time.

API

var reaper = new Reaper()

var Reaper = require('fs-reap');
var reaper = new Reaper();

reaper.watch(dir)

A directory to reap.

reaper.watch('/tmp');
reaper.watch('build');

reaper.maxAge(ms)

Set the max age based on mtime for deletion, defaulting to Infinity.

reaper.maxAccessedAge(ms)

Set the max age based on atime for deletion, defaulting to Infinity.

reaper.run().then( => )

Recursively iterate through directories and delete old files. Only one file descriptor is used at a time, so you shouldn't see any significant performance loss. For best performance, use a lot of folders.