How to use the combined-stream.create function in combined-stream

To help you get started, we’ve selected a few combined-stream 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 Azure / Azurite / lib / core / blob / StorageManager.js View on Github external
putBlockList(request) {
        let blockPaths = [];
        for (const block of request.payload) {
            const blockId = env.blockId(request.containerName, request.blobName, block.id);
            blockPaths.push(env.diskStorageUri(blockId));
        }
        // Updating properties of blob
        const coll = this.db.getCollection(request.containerName);
        const blobProxy = this._createOrUpdateBlob(coll, request);
        // Writing multiple blocks to one blob
        const combinedStream = CombinedStream.create();
        for (const path of blockPaths) {
            combinedStream.append(fs.createReadStream(path));
        }
        return new BbPromise((resolve, reject) => {
            const destinationStream = fs.createWriteStream(request.uri);
            destinationStream
                .on('error', (e) => {
                    reject(e);
                })
                .on('finish', () => {
                    let totalSize = 0;
                    // Set Blocks in DB to committed = true, delete blocks not in BlockList
                    const promises = [];
                    const blocks = coll.chain()
                        .find({ parentId: request.id })
                        .data();
github steedos / object-server / server / bundle / programs / server / packages / steedos_cfs-tempstore.js View on Github external
}) || {};
  var totalChunks = FS.Utility.size(chunkInfo.keys);

  function getNextStreamFunc(chunk) {
    return Meteor.bindEnvironment(function (next) {
      var fileKey = _fileReference(fileObj, chunk);

      var chunkReadStream = FS.TempStore.Storage.adapter.createReadStream(fileKey);
      next(chunkReadStream);
    }, function (error) {
      throw error;
    });
  } // Make a combined stream


  var combinedStream = CombinedStream.create(); // Add each chunk stream to the combined stream when the previous chunk stream ends

  var currentChunk = 0;

  for (var chunk = 0; chunk < totalChunks; chunk++) {
    combinedStream.append(getNextStreamFunc(chunk));
  } // Return the combined stream


  return combinedStream;
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
github muffin / server / lib / files.js View on Github external
const db = require('./db')
const mongoose = db.goose
const conn = db.rope

const combinedStream = require('combined-stream').create()
const fs = require('fs')
const grid = require('gridfs-stream')
const fileType = require('file-type')

grid.mongo = mongoose.mongo

conn.once('open', function () {
  console.log('Conn open!')

  const gfs = grid(conn.db)
  const file = __dirname + '/../public/vectors/sample.png'

  fs.readFile(file, function (err, data) {
    if (err) {
      throw err
    }
github koajs / kick-off-koa / credits.js View on Github external
function credits (workshopper) {
  combinedStream
    .create()
    .append(read ('./i18n/credits/' + workshopper.lang + '.txt'))
    .append(read ('./credits.txt'))
    .on("error", function (err) {
      console.log(err)
      throw err
    })
    .on("data", function (data) {
      console.log(colors(data))
    })
    .resume()
}
github ccarruitero / makemehapi / credits.js View on Github external
function credits (workshopper) {
  combinedStream
    .create()
    .append(read(`./i18n/credits/${workshopper.lang}.txt`))
    .append(read('./credits.txt'))
    .on('error', (err) => {
      console.log(err);
      throw err;
    })
    .on('data', (data) => {
      console.log(colorsTmpl(data));
    })
    .resume();
}
github IjzerenHein / autolayout.js / build / dist.js View on Github external
function dist(kiwi, minify) {
    var input = CombinedStream.create();
    input.append(!kiwi ? 'var c = require(\'cassowary/bin/c\')\n' : 'var kiwi = require(\'kiwi.js\')\n');
    input.append(fs.createReadStream('./tmp/autolayout.es6'));
    var output = fs.createWriteStream('dist/autolayout' + (kiwi ? '.kiwi' : '') + (minify ? '.min' : '') + '.js');
    output.write(banner);
    output.write(kiwi ? kiwiBanner : cassowaryBanner);
    var b = browserify(input, {
        debug: minify,
        standalone: 'AutoLayout',
        banner: banner
    });
    b = b.transform(babelify.configure({
        compact: false,
        presets: ['es2015'],
        ignore: /\/kiwi\//
    }));
    b = b.transform(envify({
github AppGeo / emberate / lib / addonResolver.js View on Github external
module.exports = function(options) {
  var stream = CombinedStream.create();
  var moduleList = fs.readdirSync('node_modules');
  moduleList.forEach(function (moduleName) {
    var modulePath = path.resolve(path.join('node_modules', moduleName));
    try {
      var data = readJson(path.join(modulePath, 'package.json'));
    } catch (err) {
      return;
    }
    if (isAddon(data)) {
      options.addonList.push(moduleName);
      var addonPath = path.resolve(path.join(modulePath, 'addon'));
      crawlPath(stream, addonPath);
      var addonAppPath = path.resolve(path.join(modulePath, 'app'));
      crawlPath(stream, addonAppPath);
    }
  });
github pelias / openstreetmap / stream / multiple_pbfs.js View on Github external
function createCombinedStream(){
  var fullStream = combinedStream.create();
  var defaultPath= require('pelias-config').generate().imports.openstreetmap;

  defaultPath.import.forEach(function( importObject){
    var conf = {
      file: path.join(defaultPath.datapath, importObject.filename),
      leveldb: defaultPath.leveldbpath,
      importVenues: importObject.importVenues
    };
    fullStream.append(function(next){
      logger.info('Creating read stream for: ' + conf.file);
      next(pbf.parser(conf));
    });
  });

  return fullStream;
}
github philsawicki / Angular-StockWatcher / gulpfile.js View on Github external
var libs = [
        //'./app/bower_components/html5-boilerplate/js/vendor/modernizr-2.6.2.min.js',
        //'./app/bower_components/jquery/dist/jquery.js',
        //'./app/bower_components/angular/angular.js',
        //'./app/bower_components/angular-route/angular-route.js',
        //'./app/bower_components/bootstrap/dist/js/bootstrap.min.js',
        //'./app/bower_components/globalize/lib/globalize.js',
        //'./app/bower_components/globalize/lib/cultures/globalize.culture.en-GB.js',
        //'./app/bower_components/d3/d3.min.js',
        //'./app/bower_components/jquery-mockjax/jquery.mockjax.js'
        
        './app/js/**/*.js',
        './tmp/templates.js'
    ];

    var jsStream = cs.create();
    jsStream.append(gulp.src(libs));

    return jsStream
        .pipe(concat('scripts.js'))
        .pipe(uglify())
        .pipe(gulp.dest('./dist/js/'));
});
github pelias / whosonfirst / src / readStream.js View on Github external
function createSQLiteRecordStream(dbPaths, importPlace) {
  const sqliteStream = combinedStream.create();

  dbPaths.forEach((dbPath) => {
    getPlacetypes().forEach(placetype => {
      sqliteStream.append( (next) => {
        logger.debug( `Loading '${placetype}' of ${path.basename(dbPath)} database from ${path.dirname(dbPath)}` );
        const sqliteStatement = importPlace ?
          SQLiteStream.findGeoJSONByPlacetypeAndWOFId(placetype, importPlace) :
          SQLiteStream.findGeoJSONByPlacetype(placetype);
        next(new SQLiteStream(dbPath, sqliteStatement));
      });
    });
  });

  return sqliteStream;
}

combined-stream

A stream that emits multiple other streams one after another.

MIT
Latest version published 5 years ago

Package Health Score

71 / 100
Full package analysis

Similar packages