• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1var request = require('request')
2  , JSONStream = require('JSONStream')
3  , es = require('event-stream')
4
5var parser = JSONStream.parse(['rows', true]) //emit parts that match this path (any element of the rows array)
6  , req = request({url: 'http://isaacs.couchone.com/registry/_all_docs'})
7  , logger = es.mapSync(function (data) {  //create a stream that logs to stderr,
8    console.error(data)
9    return data
10  })
11
12req.pipe(parser)
13parser.pipe(logger)
14