Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

barrier-readdir.js 602B

1234567891011121314151617181920212223242526272829
  1. var mod_fs = require('fs');
  2. var mod_path = require('path');
  3. var mod_vasync = require('../lib/vasync');
  4. var barrier = mod_vasync.barrier();
  5. barrier.on('drain', function () {
  6. console.log('all files checked');
  7. });
  8. barrier.start('readdir');
  9. mod_fs.readdir(__dirname, function (err, files) {
  10. barrier.done('readdir');
  11. if (err)
  12. throw (err);
  13. files.forEach(function (file) {
  14. barrier.start('stat ' + file);
  15. var path = mod_path.join(__dirname, file);
  16. mod_fs.stat(path, function (err2, stat) {
  17. barrier.done('stat ' + file);
  18. console.log('%s: %d bytes', file, stat['size']);
  19. });
  20. });
  21. });