localwatch
Watch a directory and get a diff of changes
npm install localwatch
Usage
const Localwatch = require('localwatch')
const watch = new Localwatch('./my/dir')
for await (const diff of watch) {
}
API
stream = new Localwatch(dir, [options])
Make a watch stream.
Options include
{
filter (filename, stream) { ... },
relative: false,
hidden: false,
settle: true
}
The stream yields diffs which look like this
[{
type: 'update' || 'delete',
filename
}, {
...
}]
The diff reflects the changes that happens since the last yield.
Localwatch.defaultFilter(filename, [stream])
Does the default filter. Useful if you wanna expand on the defaults.
License
Apache-2.0