all_docs.js 459 B

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