jsonstream.js 406 Bytes
Newer Older
liang ce committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
'use strict'

const check = require('check-types')
const BfjStream = require('./stream')
const util = require('util')

util.inherits(JsonStream, BfjStream)

module.exports = JsonStream

function JsonStream (read, options) {
  if (check.not.instanceStrict(this, JsonStream)) {
    return new JsonStream(read, options)
  }

  return BfjStream.call(this, read, Object.assign({ encoding: 'utf8' }, options))
}