Siehe Code:Wie zwei fileStat.mtime in Nodejs zu vergleichen?
var fs = require('fs');
var file = "e:/myfile.txt";
fs.stat(file, function(err, stat1) {
console.log(stat1.mtime);
fs.stat(file, function(err, stat2) {
console.log(stat2.mtime);
console.log(stat1.mtime == stat2.mtime);
console.log(stat1.mtime === stat2.mtime);
});
});
Und das Ergebnis:
Sun, 20 May 2012 15:47:15 GMT
Sun, 20 May 2012 15:47:15 GMT
false
false
ich während der Ausführung hat die Datei nicht ändern. Aber man kann ganz gleich ==
oder ===
sehen, sie sind nicht gleich.
Wie zwei mtime
in Nodejs zu vergleichen?