How to use the vinyl-file.read function in vinyl-file

To help you get started, we’ve selected a few vinyl-file 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 sexdevil / LSLoader / node_modules / gulp-rev / index.js View on Github external
function getManifestFile(opts, cb) {
	file.read(opts.path, opts, function (err, manifest) {
		if (err) {
			// not found
			if (err.code === 'ENOENT') {
				cb(null, new gutil.File(opts));
			} else {
				cb(err);
			}

			return;
		}

		cb(null, manifest);
	});
}
github teambit / bit / src / extensions / extension-file.ts View on Github external
static async load(
    name: string,
    filePath: PathOsBased,
    consumerPath: PathOsBased,
    base: PathOsBased = consumerPath,
    extendedProps?: Record
  ): Promise {
    try {
      const baseFile = await vinylFile.read(filePath, { base, cwd: consumerPath });
      // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
      const file = new ExtensionFile(baseFile);
      file.name = name;
      // @ts-ignore AUTO-ADDED-AFTER-MIGRATION-PLEASE-FIX!
      file.file = Source.from(file.contents);
      const addToFile = (value, key) => (file[key] = value); /* eslint-disable-line no-return-assign */
      R.forEachObjIndexed(addToFile, extendedProps);
      return file;
    } catch (err) {
      logger.error(`failed loading file ${filePath}. Error: ${err}`);
      if (err.code === 'ENOENT' && err.path) {
        throw new ExtensionFileNotFound(err.path);
      }
      throw err;
    }
  }
github WeideMo / gulp-revm / index.js View on Github external
function getManifestFile(opts, cb) {
	file.read(opts.path, opts, function (err, manifest) {
		if (err) {
			// not found
			if (err.code === 'ENOENT') {
				cb(null, new gutil.File(opts));
			} else {
				cb(err);
			}

			return;
		}

		cb(null, manifest);
	});
}
github pivotal-cf / pivotal-ui / tasks / monolith.js View on Github external
map((cssDependency, callback) => {
      if (puiCssPrefixRegexp.test(cssDependency.packageName)) {
        const componentName = cssDependency.packageName.replace(puiCssPrefixRegexp, '');
        read(`src/pivotal-ui/components/${componentName}/${componentName}.scss`, callback);
      } else {
        callback();
      }
    }),
github StavinLi / the-subway-of-china / node_modules / gulp-rev / index.js View on Github external
const getManifestFile = opts => vinylFile.read(opts.path, opts).catch(err => {
    if (err.code === 'ENOENT') {
        return new Vinyl(opts);
    }

    throw err;
});
github cgross / gulp-dom-src / index.js View on Github external
async.eachSeries(filenames, function(filename, eachCallback) {
            vinylFile.read(filename, function(err, file) {
                if (err) return eachCallback(err);

                throughStream.push(file);
                eachCallback();
            });
        }, function(err) {
            throughCallback(err);
github sindresorhus / gulp-rev / index.js View on Github external
const getManifestFile = async options => {
	try {
		return await vinylFile.read(options.path, options);
	} catch (error) {
		if (error.code === 'ENOENT') {
			return new Vinyl(options);
		}

		throw error;
	}
};
github stolksdorf / vitreum / node_modules / gulp-watch / index.js View on Github external
setTimeout(function () {
            vinyl.read(filepath, opts, write.bind(null, event));
        }, opts.readDelay);
    }
github scrapjs / pull-vinyl / index.js View on Github external
pull.asyncMap(function (filePath, cb) {
      vinylFile(filePath, options)
      .then(file => cb(null, file))
      .catch(cb)
    })
  )

vinyl-file

Create a vinyl file from an actual file

MIT
Latest version published 2 years ago

Package Health Score

65 / 100
Full package analysis

Popular vinyl-file functions