How to use the string_decoder/.StringDecoder function in string_decoder

To help you get started, we’ve selected a few string_decoder examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github onehilltech / blueprint / packages / blueprint-gatekeeper / src / server / node_modules / body-parser / node_modules / raw-body / index.js View on Github external
stream.pause()

    process.nextTick(function () {
      var err = makeError('stream encoding should not be set',
        'stream.encoding.set')
      // developer error
      err.status = err.statusCode = 500
      done(err)
    })
    return defer
  }

  var received = 0
  // note: we delegate any invalid encodings to the constructor
  var decoder = options.encoding
    ? new StringDecoder(options.encoding === true ? 'utf8' : options.encoding)
    : null
  var buffer = decoder
    ? ''
    : []

  stream.on('data', onData)
  stream.once('end', onEnd)
  stream.once('error', onEnd)
  stream.once('close', cleanup)

  return defer

  // yieldable support
  function defer(fn) {
    done = fn
  }

string_decoder

The string_decoder module from Node core

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis