It takes a fstream as input and returns a gulp stream of vinyl files.
var fstream = require("fstream");
var vfs = require("vinyl-fstream");
gulp.task("copy", function() {
return vfs.src(fstream.Reader("./"))
.pipe(gulp.dest("../dist"));
}
Note: this example is only for instructional purpose, as it is easier to use gulp.src("./*")
.
var npmPacker = require("fstream-npm");
var vfs = require("vinyl-fstream");
var zip = require("gulp-zip");
gulp.task("zip", function() {
return vfs.src(npmPacker("./"))
.pipe(zip(fileName))
.pipe(gulp.dest("dist"));
}
Note: fstream-npm takes in consideration .npmignore
and package.json files
property, so the zip will contain only what would be packaged by npm pack
.
streams: It can be a fstream or an array of fstreams
options (optional): It accepts the "read" and "buffer" options of vinyl-fs.
Note: Usually fstream entries are consumed one at a time and fstream's api doesn't state if entries can be consumed simultaneously, so use buffer: false
under your own risk.