Create vinyl files from glob patterns
$ npm install --save vinyl-read
const vinylRead = require('vinyl-read');
vinylRead('*.js').then(files => {
console.log(files.length);
//=> '2'
console.log(files[0].path);
//=> '/Users/samverschueren/dev/vinyl-read/index.js'
});
const files = vinylRead.sync(['*.js', '!index.js']);
console.log(files.length);
//=> '1'
console.log(file[0].path);
//=> '/Users/samverschueren/dev/vinyl-read/test.js'
Returns a promise for an array of vinyl files.
Create an array of vinyl files synchronously and return them.
Type: string
, array
See supported minimatch
patterns.
Type: string
Default: process.cwd()
Override the base
of the vinyl file.
Type: string
Default: process.cwd()
Override the cwd
(current working directory) of the vinyl file.
Type: boolean
Default: true
Setting this to false
will return file.contents
as a stream. This is useful when working with large files. Note: Plugins might not implement support for streams.
Type: boolean
Default: true
Setting this to false
will return file.contents
as null and not read the file at all.
- vinyl-file - Create a vinyl file from an actual file
MIT © Sam Verschueren