fs.stat
accepts two parameters, the first is the file, the second is the callback, which by node convention accepts two parameters, an error and the stats of the file:
fs.stat(path, callback)
which could be seen as
fs.stat(path, function(err, stats){
// ...
});
This is why it works, fs.stat
is called by passing exactly what it needs.
More info: http://nodejs.org/api/fs.html#fs_fs_stat_path_callback