function file(i) {
    var filename = files[Number(i)];
    fs.stat(__dirname + '/' + filename, function(err, stat) {
      if(err) {
        return console.error(err);

      }
      stats[i] = stat;
      if(stat.isDirectory()) {
        console.log('    ' + i + '    \033[36m' + filename + '\033[39m');

      } else {
        console.log('    ' + i + '    \033[90m' + filename + '\033[39m');

      }

      if(++i === files.length) {
        read();
      } else {
        file(i);
      }
    })
  }
// called for each file walked in the directory
called for each file walked in the directory
called for each file walked in the directory
function file(i) {
    var filename = files[Number(i)];
    fs.stat(__dirname + '/' + filename, function(err, stat) {
      if(err) {
        return console.error(err);
      }
      stats[i] = stat;
      if(stat.isDirectory()) {
        console.log('    ' + i + '    \033[36m' + filename + '\033[39m');
      } else {
        console.log('    ' + i + '    \033[90m' + filename + '\033[39m');
      }
      if(++i === files.length) {
        read();
      } else {
        file(i);
      }
    })
  }
function file ( i ) { var filename = files [ Number ( i ) ] ; fs . stat ( __dirname + '/' + filename , function ( err , stat ) { if ( err ) { return console . error ( err ) ; } stats [ i ] = stat ; if ( stat . isDirectory ( ) ) { console . log ( '    ' + i + '    \033[36m' + filename + '\033[39m' ) ; } else { console . log ( '    ' + i + '    \033[90m' + filename + '\033[39m' ) ; } if ( ++ i === files . length ) { read ( ) ; } else { file ( i ) ; } } ) }
called for each file walked in the directory
called for each file walked in the directory