Skip to content

Commit

Permalink
Update readme example to streams2.
Browse files Browse the repository at this point in the history
  • Loading branch information
goto-bus-stop committed May 24, 2019
1 parent 9409a90 commit 18ea003
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions readme.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ parser to operate on the HTTP body.
``` js
var splicer = require('stream-splicer');
var through = require('through2');
var JSONStream = require('JSONStream');
var split = require('split');
var jsonStream = require('jsonstream2');
var split = require('split2');

var headerData = {};
var headers = through.obj(function (buf, enc, next) {
var line = buf.toString('utf8');
if (line === '') {
this.push(headerData);
pipeline.splice(1, 1, JSONStream.parse([ 'rows', true ]));
pipeline.splice(1, 1, jsonStream.parse([ 'rows', true ]));
}
else {
var m = /^(\S+):(.+)/.exec(line);
Expand All @@ -35,7 +35,7 @@ var headers = through.obj(function (buf, enc, next) {
}
next();
});
var pipeline = splicer([ split(), headers, JSONStream.stringify() ]);
var pipeline = splicer([ split(), headers, jsonStream.stringify() ]);
process.stdin.pipe(pipeline).pipe(process.stdout);
```

Expand Down

0 comments on commit 18ea003

Please sign in to comment.