Skip to content

Commit 85530cd

Browse files
terinjokesJames Halliday
authored andcommitted
Don't include stream sinks in the pipeline [skip ci]
The documentation shouldn't suggest including stream sinks as part of the pipeline, as this leads to incorrect behavior when the included stream is a WritableStream. Instead, the output of a pipeline should be piped to a stream sink.
1 parent 6990ad1 commit 85530cd

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

readme.markdown

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,22 @@ var splicer = require('labeled-stream-splicer');
1515
var through = require('through2');
1616
var deps = require('module-deps');
1717
var pack = require('browser-pack');
18+
var lstream = require('lstream');
1819

1920
var pipeline = splicer.obj([
20-
'deps', [ deps(__dirname + '/browser/main.js') ],
21-
'pack', [ pack({ raw: true }) ],
22-
process.stdout
21+
'deps', [ deps() ],
22+
'pack', [ pack({ raw: true }) ]
2323
]);
2424

25+
pipeline.get('deps').unshift(lstream());
26+
2527
pipeline.get('deps').push(through.obj(function (row, enc, next) {
2628
row.source = row.source.toUpperCase();
2729
this.push(row);
2830
next();
2931
}));
32+
33+
process.stdin.pipe(pipeline).pipe(process.stdout);
3034
```
3135

3236
Here the `deps` sub-pipeline is augmented with a post-transformation that

0 commit comments

Comments
 (0)