How to use the stream-splicer.obj function in stream-splicer

To help you get started, we’ve selected a few stream-splicer 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 datproject / dat / lib / transformations.js View on Github external
proc.stderr.resume() // drain it!
  proc.unref()
  proc.stderr.unref()
  proc.stdout.unref()
  proc.stdin.unref()
  
  var serializer = ldjson.serialize()
  var parser = ldjson.parse()
  
  if (process.env.DEBUG) {
    serializer.pipe(debugStream('transform input: '))
    dup.pipe(debugStream('transform output: '))
  }
  
  return splicer.obj([serializer, dup, parser])
}
github datproject / dat / lib / transformations.js View on Github external
module.exports = function(transforms) {
  transforms = transforms
    .map(normalize)
    .map(function(t, i) {
      debug('Registering transform #' + i, t)
      // TODO: support more formats
      if (typeof t === 'function') return t()
      if (typeof t.pipe === 'function') return t
      if (t.format !== 'json') throw new Error('Transform #'+i+' not a non supported format')
      if (t.command) return command(t)
      if (t.module)  return mod(t)

      throw new Error('Transform #'+i+' is not currently support')
    })

  return splicer.obj(transforms)
}

stream-splicer

streaming pipeline with a mutable configuration

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis