You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rdrew
1440706ce3
|
6 years ago | |
---|---|---|
.. | ||
lib | 6 years ago | |
node_modules | 6 years ago | |
LICENSE | 6 years ago | |
README.md | 6 years ago | |
index.js | 6 years ago | |
package.json | 6 years ago |
README.md
vinyl-fs
Information
Package | vinyl-fs |
Description | Vinyl adapter for the file system |
Node Version | >= 0.10 |
Usage
var map = require('map-stream');
var fs = require('vinyl-fs');
var log = function(file, cb) {
console.log(file.path);
cb(null, file);
};
fs.src(['./js/**/*.js', '!./js/vendor/*.js'])
.pipe(map(log))
.pipe(fs.dest('./output'));
API
src(globs[, opt])
- Takes a glob string or an array of glob strings as the first argument.
- Possible options for the second argument:
- cwd - Specify the working directory the folder is relative to. Default is
process.cwd()
- base - Specify the folder relative to the cwd. Default is where the glob begins. This is used to determine the file names when saving in
.dest()
- buffer -
true
orfalse
if you want to buffer the file.- Default value is
true
false
will make file.contents a paused Stream
- Default value is
- read -
true
orfalse
if you want the file to be read or not. Useful for stuff likerm
ing files.- Default value is
true
false
will disable writing the file to disk via.dest()
- Default value is
- Any glob-related options are documented in glob-stream and node-glob
- cwd - Specify the working directory the folder is relative to. Default is
- Returns a Readable/Writable stream.
- On write the stream will simply pass items through.
- This stream emits matching vinyl File objects
watch(globs[, opt, cb])
This is just glob-watcher
- Takes a glob string or an array of glob strings as the first argument.
- Possible options for the second argument:
- Any options are passed to gaze
- Returns an EventEmitter
- 'changed' event is emitted on each file change
- Optionally calls the callback on each change event
dest(folder[, opt])
- Takes a folder path as the first argument.
- First argument can also be a function that takes in a file and returns a folder path.
- Possible options for the second argument:
- cwd - Specify the working directory the folder is relative to. Default is
process.cwd()
- mode - Specify the mode the files should be created with. Default is the mode of the input file (file.stat.mode)
- cwd - Specify the working directory the folder is relative to. Default is
- Returns a Readable/Writable stream.
- On write the stream will save the vinyl File to disk at the folder/cwd specified.
- After writing the file to disk, it will be emitted from the stream so you can keep piping these around
- The file will be modified after being written to this stream
cwd
,base
, andpath
will be overwritten to match the folderstat.mode
will be overwritten if you used a mode parametercontents
will have it's position reset to the beginning if it is a stream