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

To help you get started, we’ve selected a few glob-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 mdittmer / web-apis / lib / idl / LocalSourceRunner.es6.js View on Github external
run() {
    // TODO: Do something more robust?
    if (this.running) throw new Error('LocalSourceRunner already running');
    this.running = true;

    // Clear runner-output-data.
    this.eachFilePromises = [];
    this.fileResults = [];

    this.sourceHash = this.getGitHash();

    // Compose fresh set of memos for main pipeline computation(s).
    this.pipeline = this.createPipeline();

    // Find files for pipeline inputs
    this.globStream = gs.create(`${this.sourcePath}/**/*.${this.extension}`, {
      ignore: this.ignoreGlobs,
    });
    this.globStream.on(
      'data',
      file => this.processFile(file.path.substr(`${this.sourcePath}/`.length))
    );

    // Return Promise handled by streaming input event listeners.
    return new Promise((resolve, reject) => {
      this.globStream.on('error', error => {
        return Promise.resolve(this.onError(resolve, reject, error));
      });
      this.globStream.on('end', data => {
        return Promise.all(this.eachFilePromises).then(
          this.onDataReady.bind(this, resolve, reject, data),
          this.onError.bind(this, resolve, reject)
github BorisMoore / jsrender / gulpfile.js View on Github external
gulp.task('bundle', function() {
	var tmplify = require('./tmplify');
	var gs = require('glob-stream');

	return gs.create('./test/browserify/*-unit-tests.js')
		.on('data', function(file) {
			// file has path, base, and cwd attrs
			var fileName = file.path.slice(file.base.length, -14);
			browserify(file.path, {debug:true})
				.transform(tmplify)
				.bundle()
				.pipe(fs.createWriteStream('./test/browserify/bundles/' + fileName + "-bundle.js"))
				.on('error', function(err) {
					// Make sure failed tests cause gulp to exit non-zero 
					throw err;
				});
		});
});
github agershun / alasql / node_modules / gulp / node_modules / vinyl-fs / lib / src / index.js View on Github external
if (!isValidGlob(glob)) {
    throw new Error('Invalid glob argument: ' + glob);
  }
  // return dead stream if empty array
  if (Array.isArray(glob) && glob.length === 0) {
    process.nextTick(pass.end.bind(pass));
    return pass;
  }

  var options = defaults({}, opt, {
    read: true,
    buffer: true
  });

  var globStream = gs.create(glob, options);

  // when people write to use just pass it through
  var outputStream = globStream
    .pipe(through.obj(createFile))
    .pipe(getStats(options));

  if (options.read !== false) {
    outputStream = outputStream
      .pipe(getContents(options));
  }

  return outputStream.pipe(pass);
}
github FredHutch / Oncoscape / client / node_modules / gulp-useref / node_modules / vinyl-fs / lib / src / index.js View on Github external
}, opt);
  var pass, inputPass;

  if (!isValidGlob(glob)) {
    throw new Error('Invalid glob argument: ' + glob);
  }
  // return dead stream if empty array
  if (Array.isArray(glob) && glob.length === 0) {
    pass = through.obj();
    if (!options.passthrough) {
      process.nextTick(pass.end.bind(pass));
    }
    return pass;
  }

  var globStream = gs.create(glob, options);

  var outputStream = globStream
    .pipe(resolveSymlinks())
    .pipe(through.obj(createFile));

  if (options.since) {
    outputStream = outputStream
      .pipe(filterSince(options.since));
  }

  if (options.read !== false) {
    outputStream = outputStream
      .pipe(getContents(options));
  }

  if (options.passthrough) {
github BorisMoore / jsviews / gulpfile.js View on Github external
gulp.task('bundle', function() {
	var tmplify = require('jsrender/tmplify');
	var gs = require('glob-stream');

	return gs.create('./test/browserify/*-unit-tests.js')
		.on('data', function(file) {
			// file has path, base, and cwd attrs
			var fileName = file.path.slice(file.base.length, -14);
			browserify(file.path, {debug:true})
				.transform(tmplify)
				.bundle()
				.pipe(fs.createWriteStream('./test/browserify/bundles/' + fileName + "-bundle.js"))
				.on('error', function(err) {
					// Make sure failed tests cause gulp to exit non-zero 
					throw err;
				});
		});
});
github BorisMoore / jsviews.com / gulpfile.js View on Github external
gulp.task('bundle', function() {
	var tmplify = require('jsrender/tmplify');
	var gs = require('glob-stream');

	return gs.create('./test/browserify/*-unit-tests.js')
		.on('data', function(file) {
			// file has path, base, and cwd attrs
			var fileName = file.path.slice(file.base.length, -14);
			browserify(file.path, {debug:true})
				.transform(tmplify)
				.bundle()
				.pipe(fs.createWriteStream('./test/browserify/bundles/' + fileName + "-bundle.js"))
				.on('error', function(err) {
					// Make sure failed tests cause gulp to exit non-zero 
					throw err;
				});
		});
});
github peter-mouland / web-caddy / tasks / utils / fs.js View on Github external
function glob(globArray){
    var stream = gs.create(globArray, { allowEmpty: true });
    return new Promise(function(resolve, reject){
        var files = [];
        stream.on('data', function(fileObj){
            files.push(new File(fileObj));
        });
        stream.on('end', function(err){
            err && reject(err);
            !err && resolve(files);
        });

    });
}
github madebysource / pho-devstack / lib / get-files.js View on Github external
var files = function(dir, format) {
  return gs.create(dir)
    .pipe(through.obj(function(file, enc, callback) {
      this.push(format(path.basename(file.path)));
      callback();
    }));
};
github tunnckoCore / fs-readdir / benchmark / code / glob-stream.js View on Github external
module.exports = function index(root, cb) {
  root = path.join(root, '../playing');
  return gs.create([
    root + '/*.*',
    root + '/**/*.*',
    root + '/**/.*',
    root + '/.*'
  ], {
    cwd: root
  }).on('data', cb);
};

glob-stream

Readable streamx interface over anymatch.

MIT
Latest version published 25 days ago

Package Health Score

89 / 100
Full package analysis