Find broken symlinks and destroy them
$ npm install -g unlink-broken-linksunlink-broken-links [directory]
Options:
--version Show version number [boolean]
--recursive, -r Recursively walk the directory [boolean] [default: false]
--help, -h Show help [boolean]
var unlinkBrokenLinks = require('unlink-broken-links');
// "recursive" defaults to false
unlinkBrokenLinks('/some/path', {recursive: true})
.then(function(result) {
console.log(result.removed); // array of removed files (if any)
console.log(result.errors); // array of errors (if any)
});
// or callback-style
unlinkBrokenLinks('/some/path', {recursive: true}, function(err, result) {
// "err" will only be truthy if something's terribly wrong
console.log(result.removed); // array of removed files (if any)
console.log(result.errors); // array of errors (if any)
});© 2015 Christopher Hiller. Licensed MIT.