How can I read two file using fs and have both result available in a way , where I can compare them. I looked at this but its slightly different and I couldnt find a way to do what I need.
I can call the diffChars
from callback, but how to do with two callback functions?
fs.readFile('/abc1.txt', function (err, data1) {
console.log(data1);
});
fs.readFile('/abc1.txt', function (err, data2) {
console.log(data2);
});
later I want to do like this
var fileDiff = require("diff");
var difference = fileDiff.diffChars(data1,data2);
cnsole.log(difference);
note: I am restrictive on libraries I can use because of npm proxy repository