Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80529 views
1
var request = require('request')
2
, JSONStream = require('JSONStream')
3
, es = require('event-stream')
4
5
var 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
12
req.pipe(parser)
13
parser.pipe(logger)
14
15