pull-couch

Parse the rows out of a couchdb views query without parsing it as one large json object. instead split based on the format couchdb happens to use (delimited by \r) and then parse each line with `JSON.parse`. This is much faster than parsing everything wit

Usage no npm install needed!

<script type="module">
  import pullCouch from 'https://cdn.skypack.dev/pull-couch';
</script>

README

pull-couch

Parse the rows out of a couchdb views query without parsing it as one large json object. instead split based on the format couchdb happens to use (delimited by \r) and then parse each line with JSON.parse. This is much faster than parsing everything with a streaming parser (if implemented in js), such as JSONStream

this module is a pull-stream

example

var pull = require('pull-stream')
var toPull = require('stream-to-pull-stream')
var Couch = require('pull-couch')
pull(
  toPull.source(request('https://skimdb.npmjs.com/registry/_all_docs')),
  Couch(function (header) {
    //the headers are pased to this cb
    console.log('header', header)
  }),

  //the rest of the data is streamed out.
  pull.drain(console.log)
)

License

MIT