dir-equals
check if two directories are the same, with support for custom fs
Currently checks:
- total file count
- total size
- total directory count
Warning: Could have false positives if all the above are the same.
Install
npm install dir-equals
Usage
var compare = require('compare-folder')
compare('dir-one', 'dir-two', function (err, isSame) {
if (err) throw err
if (isSame) {
console.log('Directories are the same.')
} else {
console.log('Directories are different.')
}
})
API
compare(dir1, dir2, [opts], cb)
The dir
variables are either paths or {name, fs}
for custom fs.
Use custom fs:
var dir1 = {fs: customFs, name: '/'}
TODO:
- Add options for more in depth checks
- Check file names
- Check fs.stat results
- Check file contents
License
MIT