How to use the stream-combiner.apply function in stream-combiner

To help you get started, we’ve selected a few stream-combiner 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 rotundasoftware / cartero / index.js View on Github external
var finalBundlePath = finalBundlePathWithoutShasumAndExt + '_' + bundleShasum  + path.extname( tempBundlePath );

			bundleStream = fs.createReadStream( tempBundlePath );

			// this is part of a hack to apply the ##url transform to javascript files. see comments in transforms/resolveRelativeAssetUrlsToAbsolute
			var postProcessorsToApply = _.clone( _this.postProcessors );
			if( assetType === 'script' ) postProcessorsToApply.unshift( function( file ) { return assetUrlTransform( file, {
				packagePathsToIds : _this.packagePathsToIds,
				outputDirUrl : _this.outputDirUrl,
				assetMap: _this.assetMap,
				appRootDir : _this.appRootDir
			} ); } );

			if( postProcessorsToApply.length !== 0 ) {
				// apply post processors
				bundleStream = bundleStream.pipe( combine.apply( null, postProcessorsToApply.map( function( thisPostProcessor ) {
					return thisPostProcessor( finalBundlePath );
				} ) ) );
			}

			bundleStream.pipe( fs.createWriteStream( finalBundlePath ).on( 'close', function() {
				if( fs.existsSync( tempBundlePath ) ) fs.unlinkSync( tempBundlePath );
				_this.emit( 'fileWritten', finalBundlePath, assetType, true, this.watching );

				callback( null, finalBundlePath );
			} ) );
		} ) );
	} );
github dapphub / dapple / lib / pipelines.js View on Github external
var SourcePipeline = function (opts) {
  // Defaults
  opts = _fillOptionDefaults(opts);

  var injectedSources = _.values(opts.modules)
  .filter(m => 'inject' in m)
  .map(m => m.inject(opts))
  .concat([streams.inject_virtual_contracts()]);

  var injected = Combine.apply(this, injectedSources);

  // Grab all the files relevant to the package.
  return Combine(
    streams.package_stream(opts.packageRoot),

    // Extendable preprocessor
    streams.xpreprocess(opts),

    injected,

    // Lodash.template is the default preprocessor.
    streams.preprocess(opts.preprocessorVars));
};
github OverZealous / lazypipe / index.js View on Github external
var build = function() {
			validateSteps(steps);
			return combine.apply(null, steps.map(function(t) {
				return t.task.apply(null, t.args);
			}));
		};
github rotundasoftware / parcelify / lib / asset.js View on Github external
Asset.prototype._applyTransforms = function( stream, transforms ) {
	var _this = this;

	if( ! transforms || transforms.length === 0 ) return stream;
	
	var combinedStream = combine.apply( null, transforms.map( function( thisTransform ) {
		return thisTransform( _this.srcPath );
	} ) );

	return stream.pipe( combinedStream );
};
github hughsk / ast-pipeline / index.js View on Github external
function pipeline(streams) {
    var count = streams.length

    debug('creating pipeline')

    streams = streams.filter(Boolean)

    if (!streams.length) return through()
    if (streams.every(isTextStream)) {
      return combine.apply(null, streams)
    }

    streams = streams.reduce(function(line, curr, i) {
      var next = streams[i+1]
      var prev = streams[i-1]

      var currIsText = isTextStream(curr)
      var nextIsText = isTextStream(next)
      var prevIsText = isTextStream(prev)

      var pushDecoder = prevIsText && !currIsText
      var pushEncoder = nextIsText && !currIsText
      var pushWrapper = currIsText

      line.push(
          pushDecoder && decoder()
github hughsk / ast-pipeline / index.js View on Github external
line.push(
          pushDecoder && decoder()
        , pushWrapper ? curr : wrap(curr)
        , pushEncoder && encoder()
      )

      if (pushDecoder) debug('decoder')
      debug(pushWrapper ? 'text' : 'ast')
      if (pushEncoder) debug('encoder')

      return line
    }, [])

    debug('finished pipeline')

    return combine.apply(null, streams.filter(Boolean))
  }
github thlorenz / transfigurify / index.js View on Github external
resolve(file, env, function (err, txfns) {
      if (err) return cb(err);

      if (!txfns) {
        self.push(data);
        return cb();
      }

      var txs = txfns.map(function (txfn) { return txfn(file) });
      var combinedTransform = combine.apply(null, txs);

      applyTransform(combinedTransform, data, function (err, src) {
        if (err) return cb(err);
        self.push(src);
        cb();
      })
    });
  }
github jsonlines / jsonfilter / index.js View on Github external
module.exports = function(filter, opts) {
  if (!opts) opts = {}
  var pipeline = [
    JSONStream.parse(filter)
  ]
  
  if (opts.match) {
    pipeline.push(createFunctionStream(opts.match, function(output, object, next) {
      if (!!output) this.push(object)
      next()
    }))
  }
  
  pipeline.push(JSONStream.stringify('', '\n', ''))
  return combiner.apply(null, pipeline)
}

stream-combiner

[![npm version](https://img.shields.io/npm/v/stream-combiner.svg)](https://npmjs.org/package/stream-combiner) [![Travis CI](https://travis-ci.org/dominictarr/stream-combiner.svg)](https://travis-ci.org/dominictarr/stream-combiner)

MIT
Latest version published 9 years ago

Package Health Score

67 / 100
Full package analysis

Popular stream-combiner functions

Similar packages