Skip to content
This repository has been archived by the owner on Jun 6, 2021. It is now read-only.
/ collect-json Public archive

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

License

Notifications You must be signed in to change notification settings

75lb/collect-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

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

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published