Small utility for node, to watch symlink changes.
var lnw = require('../lnwatch.js')
lnw.on('change', function (data) {
console.log('LINK CHANGED', data);
})
lnw.add([
'./foo',
'./qux', // nonexistent link, ignored
'./bar'
])
Add links to watch, can be a single link path string, or several in an array. Nonexistent links will be ignored.
Remove watched links, can be a single link path string, or several in an array. Nonexistent links will be ignored.
Remove all watched links.
Fired when one of the watched link changes target. Receives data about what changed:
- which link,
- from what target,
- to which target
Example:
lnw.on('change', function (data) {
console.log(data);
})
/*
outputs:
{
link: '/Users/nec/github/lnwatch/tests/bar',
from: '/Users/nec/github/lnwatch/tests/two',
to: '/Users/nec/github/lnwatch/tests/three'
}
*/