How to use the do.parallel function in do

To help you get started, we’ve selected a few do examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github creationix / node-blog / build.js View on Github external
exports.build = function (next, error_handler) {
  // Load up the data files
  Do.parallel(
    process_folder(AUTHOR_DIR),
    process_folder(ARTICLE_DIR),
    process_folder(SKIN_DIR)
  )(function (authors, articles, templates) {
    var group = Do.combo(function() {
      next("Done!\n" + Array.prototype.map.call(arguments, function (args) {
        return args[0] + " - " + args[1];
      }).join("\n"))
    });

    function write_file(filename, content) {
      var cb = group.add();
      fs.writeFile(filename, content)(function () {
        cb(new Date(), "  Wrote " + content.length + " bytes to " + filename);
      }, error_handler);
    }

do

The simplest way to manage asynchronicity

MIT
Latest version published 12 months ago

Package Health Score

59 / 100
Full package analysis