fs-reap
v2.0.0
Published
file cleanup based on atime/mtime
Downloads
12
Readme
reap
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.