fsnap
Diff filesystem snapshot results. Useful for file watch system.
Install
npm install --save fsnap
Usage
const fsnap = require('fsnap');
let s1 = fsnap.create(path);
let s2 = fsnap.create(path);
let result = fsnap.diff(s1, s2);
// do something...
console.log(result.deletes);
console.log(result.changes);
console.log(result.creates);
API Reference
Methods
fsnap.create(patterns, [options])
-
patterns
string|Array - See supportedminimatch
patterns. -
options
object - See thenode-glob
options.
create snapshot from the given patterns.
fsnap.diff(s1, s2)
-
s1
object - snapshot 1 -
s2
object - snapshot 2
Returns object
-
deletes
array - path list of deleted files and directories. -
creates
array - path list of created files and directories. -
chagnes
array - path list of changed files and directories.
fsnap.simplify(result)
-
result
object - the result offsnap.diff
Simplify the diff result by remove files contains in the directory in the same result.
License
MIT © 2017 Johnny Wu