diff options
Diffstat (limited to 'deps/npm/node_modules/JSONStream/examples/all_docs.js')
-rw-r--r-- | deps/npm/node_modules/JSONStream/examples/all_docs.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/deps/npm/node_modules/JSONStream/examples/all_docs.js b/deps/npm/node_modules/JSONStream/examples/all_docs.js new file mode 100644 index 0000000000..f20781e18c --- /dev/null +++ b/deps/npm/node_modules/JSONStream/examples/all_docs.js @@ -0,0 +1,13 @@ +var request = require('request') + , JSONStream = require('JSONStream') + , es = require('event-stream') + +var parser = JSONStream.parse(['rows', true]) //emit parts that match this path (any element of the rows array) + , req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'}) + , logger = es.mapSync(function (data) { //create a stream that logs to stderr, + console.error(data) + return data + }) + +req.pipe(parser) +parser.pipe(logger) |