1.2.1 • Published 9 years ago
fsnap v1.2.1
fsnap
Diff filesystem snapshot results. Useful for file watch system.
Install
npm install --save fsnapUsage
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)
patternsstring|Array - See supportedminimatchpatterns.optionsobject - See thenode-globoptions.
create snapshot from the given patterns.
fsnap.diff(s1, s2)
s1object - snapshot 1s2object - snapshot 2
Returns object
deletesarray - path list of deleted files and directories.createsarray - path list of created files and directories.chagnesarray - path list of changed files and directories.
fsnap.simplify(result)
resultobject - the result offsnap.diff
Simplify the diff result by remove files contains in the directory in the same result.
License
MIT © 2017 Johnny Wu