Package Exports
- dir_comparator
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (dir_comparator) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
---------------------------
T E R M I N O L O G Y
---------------------------
Dir,
is used as the short form for the word Directory.
DTN,
is used as the acronym of Dir Tree Node.
DirTreeNode is a Class defined inside the dir_tree module.
Please refer the dir_tree package: github | npm
-----------------------------
I N T R O D U C T I O N
-----------------------------
This is a NodeJS module.
It can find the difference between two directories in terms of files.
The module exports an EventEmitter Class.
Its constructor takes the 2 target dir paths as its arguments.
Its object will emit either an error event or a data event depending on
whether it failed or succeeded.
---------------
U S A G E
---------------
var Dir_Comparator = require('dir_comparator')
var dir_comparator_obj = new Dir_Comparator(target_dir_path_1, target_dir_path_2)
dir_comparator_obj.on('error', function(error) {
// The error is an Error Object.
// The error handling can be done here.
})
dir_comparator_obj.on('data', function(dtn_1, dtn_2) {
// The DTN Objects themselves contain the mutually exclusive files.
// dtn_1 corresponds to the target_dir_path_1 &
// dtn_2 corresponds to the target_dir_path_2.
// dtn_1 will have the files missing in dtn_2 & vice versa.
})
----------------------------
A C.L.I. T H I N G Y
----------------------------
There's also a CLI tool in the package, named:
c2d | compare_2_dirs
It can find out for you the mutually exclusive files in stated two dir paths.
Usage:
-----
c2d target_dir_path_1 target_dir_path_2 [ -list | -l ]
when either -list or -l is specified, the files are listed,
otherwise the default nature is to display the dir trees.
Finally, you may want to have a look at the demo example packaged inside.