npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

json-stream-to-object

1.1.0

@yoshuawuyts

npmHomeRepoSnykSocket
Downloads:694
$ npm install json-stream-to-object
DailyWeeklyMonthlyYearly

json-stream-to-object stability

npm version build status downloads js-standard-style

Parse a JSON stream into an object.

Usage

var toObject = require('json-stream-to-object')
var http = require('http')

http.createServer(function (req, res) {
  toObject(req, function (err, obj) {
    if (err) throw err
    console.log('json parsed', obj)
  })
}).listen(8080)

API

toObject(stream, [opts], cb(err, object))

Parse a stream of JSON to an object. Opts can be:

  • opts.limit: set a max size limit for the incoming data. Useful to prevent services getting DDoSed

License

MIT