src/decode.js
function decodeFromReader (reader, opts, cb) {
  if (typeof opts === 'function') {
    cb = opts
    opts = {}
  }

  _decodeFromReader(reader, opts, function onComplete (err, msg) {
    if (err) {
      if (err === true) return cb(new Error('Unexpected end of input from reader.'))
      return cb(err)
    }
    cb(null, msg)
  })
}
function decodeFromReader (reader, opts, cb) {
  if (typeof opts === 'function') {
    cb = opts
    opts = {}
  }

  _decodeFromReader(reader, opts, function onComplete (err, msg) {
    if (err) {
      if (err === true) return cb(new Error('Unexpected end of input from reader.'))
      return cb(err)
    }
    cb(null, msg)
  })
}
function decodeFromReader ( reader , opts , cb ) { if ( typeof opts === 'function' ) { cb = opts opts = { } } _decodeFromReader ( reader , opts , function onComplete ( err , msg ) { if ( err ) { if ( err === true ) return cb ( new Error ( 'Unexpected end of input from reader.' ) ) return cb ( err ) } cb ( null , msg ) } ) }
wrapper to detect sudden pull-stream disconnects
wrapper to detect sudden pull - stream disconnects