Browse files

Update the readme.

  • Loading branch information...
1 parent 14ad49e commit 58eac250b6db0861b6782c0abc8e42f9fe356b3e @creationix committed Jul 26, 2010
Showing with 6 additions and 8 deletions.
  1. +6 −8 README.markdown
@@ -47,28 +47,26 @@ Also there is support for parallel actions:
Here we pass `this.parallel()` instead of `this` as the callback. It internally keeps track of the number of callbacks issued and preserves their order then giving the result to the next step after all have finished. If there is an error in any of the parallel actions, it will be passed as the first argument to the next step.
-Also you can use parallel with a dynamic number of common tasks.
+Also you can use group with a dynamic number of common tasks.
function readDir() {
fs.readdir(__dirname, this);
function readFiles(err, results) {
if (err) throw err;
- // Create a closure to the parallel helper
- var parallel = this.parallel;
+ // Create a new group
+ var group =;
results.forEach(function (filename) {
if (/\.js$/.test(filename)) {
- fs.readFile(__dirname + "/" + filename, parallel());
+ fs.readFile(__dirname + "/" + filename, group());
- function showAll(err /*, file1, file2, ...*/) {
+ function showAll(err , files) {
if (err) throw err;
- var files =, 1);
-Note that we had to create a reference to the `this.parallel` function since the `forEach` creates a new scope and changes `this`. Then using arguments surgery we can extract the contents of the files.
+*Note* that we both call `` and `group()`. The first reserves a slot in the parameters of the next step, then calling `group()` generates the individual callbacks and increments the internal counter.

3 comments on commit 58eac25


nex3 replied Jul 27, 2010

This is pretty sweet. Is there a timeline on this change being pushed?


creationix replied Jul 27, 2010

It's been there for quite a while, but wasn't documented.

There is also a Step.fn helper, but it's not useful for most cases. See the unit tests for an example.


nex3 replied Jul 27, 2010

Oh, cool. That's definitely going to be nicer to use than parallel().

Please sign in to comment.