lib/js/PagesProbe.js
function(fileNames, callback) {
      var t = this,
          stats = [],
          didError = false,
          numLeft = fileNames.length;

      // No files to process
      if (fileNames.length === 0) {
        return callback(null, stats);
      }

      // Call stat on each file
      fileNames.forEach(function(fileName, index) {
        var fullPath = Path.join(t.dirPath, fileName);
        FS.stat(fullPath, function(error, stat) {

          // Process a stat error
          if (error) {
            didError = true;
            return callback(error);
          }

          // Do nothing if a prior error callback happened
          if (didError) {
            return;
          }

          // Set this stat item
          stats[index] = stat;

          // Callback if all stats are complete
          if (--numLeft === 0) {
            callback(null, stats);
          }
        });
      });

    }
function(fileNames, callback) {
      var t = this,
          stats = [],
          didError = false,
          numLeft = fileNames.length;

      // No files to process
      if (fileNames.length === 0) {
        return callback(null, stats);
      }

      // Call stat on each file
      fileNames.forEach(function(fileName, index) {
        var fullPath = Path.join(t.dirPath, fileName);
        FS.stat(fullPath, function(error, stat) {

          // Process a stat error
          if (error) {
            didError = true;
            return callback(error);
          }

          // Do nothing if a prior error callback happened
          if (didError) {
            return;
          }

          // Set this stat item
          stats[index] = stat;

          // Callback if all stats are complete
          if (--numLeft === 0) {
            callback(null, stats);
          }
        });
      });

    }
function ( fileNames , callback ) { var t = this , stats = [ ] , didError = false , numLeft = fileNames . length ; // No files to process if ( fileNames . length === 0 ) { return callback ( null , stats ) ; } // Call stat on each file fileNames . forEach ( function ( fileName , index ) { var fullPath = Path . join ( t . dirPath , fileName ) ; FS . stat ( fullPath , function ( error , stat ) { // Process a stat error if ( error ) { didError = true ; return callback ( error ) ; } // Do nothing if a prior error callback happened if ( didError ) { return ; } // Set this stat item stats [ index ] = stat ; // Callback if all stats are complete if ( -- numLeft === 0 ) { callback ( null , stats ) ; } } ) ; } ) ; }
Stat all the files, returning an array of file stats matching the
array of input files.

@method statFiles
@param fileNames {Array} An array of filenames to stat (from this directory)
@param callback {Function(error, stats)}
@param callback.error {Mixed} Set if an error occured
@param callback.stats {Array of Stat} An array of fs.stats objects
Stat all the files returning an array of file stats matching the array of input files .