Bir dosya dizinindeki değişiklikleri izleyen ve ardından değiştirilen dosyaları yazdıran bir node.js betiği yazmaya çalışıyorum. Bu komut dosyasını, bir dizini izleyecek (tek bir dosya yerine) ve dizindeki dosyaların adlarını değiştirildikçe yazdıracak şekilde nasıl değiştirebilirim?
var fs = require('fs'),
sys = require('sys');
var file = '/home/anderson/Desktop/fractal.png'; //this watches a file, but I want to watch a directory instead
fs.watchFile(file, function(curr, prev) {
alert("File was modified."); //is there some way to print the names of the files in the directory as they are modified?
});