vinyl-bufferstream
Deal with vinyl file contents, regardless of whether it is Buffer/Stream
var through = ;var VinylBufferStream = ; { var vinylBufferStream = { ; }; return through;}
Installation
npm install vinyl-bufferstream
API
var VinylBufferStream = ;
vinylBufferStream = new VinylBufferStream(transformFunction)
(new
operator is optional.)
transformFunction: Function
Return: Function
The argument must be a function taking a Buffer
and a callback function as its first and second argument, which calls the callback function with passing Node-style callback arguments (error, result
).
vinylBufferStream(file, callback)
file: Object
(vinyl file object)
callback: Function
When the file.contents
is a Buffer
, it will call the transformFunction with passing file.contents to the first argument.
When the file.contents
is a Stream
, it will call the transformFunction with passing the buffered stream of file.contents to the first argument.
When the file.contents
is a Stream
, it won't call the transformFunction.
callback(err, contents)
error: Error
or null
contents: Buffer
or Stream
When the file.contents
is a Buffer
, contents will be a result that transformFunction produces.
When the file.contents
is a Stream
, contents will be a stream that emits a data transformFunction produces.
When the file.contents
is null
, contents will be null
.
var gulp = ;var SVGO = ;var through = ;var VinylBufferStream = ; { var svgo = options; var vinylBufferStream = { svgo; }; return through;} gulp; gulp;
License
Copyright (c) 2014 - 2015 Shinnosuke Watanabe
Licensed under the MIT License.