1.1.0 • Published 9 years ago
pull-vinyl v1.1.0
pull-vinyl

Read and write
Vinylobjects in the file system.
pull(
// Read `Vinyl` files
vinyl.src('foo/**/*.js'),
// Transform them somehow, i.e. with a compiler.
transformVinyl(),
// Write them
vinyl.dest('output')
)Reading and writing Vinyl objects to/from the file system with pull streams. It is inspired from vinyl-fs from gulp.
Installation
$ npm install --save pull-vinylAPI
vinyl.src(pattern, [options])
Read Vinyl objects from the file system with patterns from pull-glob. You can use vinyl.read as an alias.
pattern: A glob pattern resolved bypull-glob.options(Object): Options for reading.
It works as a pull stream source:
pull(
// Resolve glob into `Vinyl` objects.
vinyl.src('foo/**/*.js'),
// Transform `Vinyl` objects...
// Then write them:
vinyl.dest('bar')
)vinyl.dest([base]])
Write Vinyl objects at the directory base. You can use vinyl.write as an alias.
base(String): The base directory for theVinylobjects. Defaults tofile.base.
pull(
// Obtain `Vinyl` objects somehow, probably through reading:
vinyl.src('foo/**/*.js'),
// Transform them before you write them:
babel(), // Example stream.
// Write them to the given directory
vinyl.dest('out')
)vinyl.map(name, [base])
Maps data into vinyl files. Essentially vinyl-source-stream as a pull-stream.
name(String|Function): String of file's name, or a function to handle per item.base(String|Function): Optional base directory string, or a function to handle per item.
pull(
// Pipe some data:
pull.values([ Buffer.from('hello world') ]),
// Map it to a file:
vinyl.map('bar.js', '/foo'),
// Use it
pull.drain(function (file) {
console.log(file)
})
)License
MIT © Jamen Marz