collect-json
Returns a stream which becomes readable with a single value once all (valid) JSON is received.
Last updated 9 years ago by 75lb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install collect-json 
SYNC missed versions from official npm registry.

view on npm npm module downloads Gihub repo dependents Gihub package dependents Build Status js-standard-style

collect-json

DEPRECATED: Please use stream-read-all instead.

collect-json

Returns a stream which becomes readable with a single value once all (valid) JSON is received.

collectJson([callback]) ⇒ Duplex

Kind: Exported function

Param Type Description
[callback] function called with the collected json data, once available. The value returned by the callback will be passed downstream.

Example
An example command-line client script - JSON received at stdin is stamped with received then written to stdout.

var collectJson = require("collect-json")

process.stdin
    .pipe(collectJson(function(json){
        json.received = true
        return JSON.stringify(json)
    }))
    .on("error", function(err){
        // input from stdin failed to parse
    })
    .pipe(process.stdout)

© 2015-21 Lloyd Brookes <75pound@gmail.com>. Documented by jsdoc-to-markdown.

Current Tags

  • 1.0.9                                ...           latest (4 years ago)

13 Versions

  • 1.0.9                                ...           4 years ago
  • 1.0.8                                ...           9 years ago
  • 1.0.7                                ...           9 years ago
  • 1.0.6                                ...           9 years ago
  • 1.0.5                                ...           9 years ago
  • 1.0.4                                ...           9 years ago
  • 1.0.3                                ...           9 years ago
  • 1.0.2                                ...           9 years ago
  • 1.0.1                                ...           9 years ago
  • 1.0.0                                ...           9 years ago
  • 0.1.1                                ...           9 years ago
  • 0.1.0                                ...           9 years ago
  • 0.0.0                                ...           9 years ago
Maintainers (1)
Downloads
Total 13
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (5)
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE