Package Exports
- vinyl-fs
- vinyl-fs/lib/dest
- vinyl-fs/lib/dest/writeContents
- vinyl-fs/lib/filterSince
- vinyl-fs/lib/prepareWrite
- vinyl-fs/lib/src
- vinyl-fs/lib/src/getContents
- vinyl-fs/lib/src/getContents/bufferFile
- vinyl-fs/lib/symlink
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (vinyl-fs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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.
- Globs are executed in order, so negations should follow positive globs. For example:
fs.src(['!b*.js', '*.js'])would not exclude any files, but this would
fs.src(['*.js', '!b*.js'])Possible options for the second argument:
cwd - Specify the working directory the folder is relative to.
- Default is
process.cwd().
- Default is
base - Specify the folder relative to the cwd. This is used to determine the file names when saving in
.dest().- Default is where the glob begins if any.
- Default is
process.cwd()if there is no glob.
buffer -
trueorfalseif you want to buffer the file.- Default value is
true. falsewill makefile.contentsa paused Stream.
- Default value is
read -
trueorfalseif you want the file to be read or not. Useful for stuff likerming files.- Default value is
true. falsewill disable writing the file to disk via.dest().
- Default value is
since -
Dateornumberif you only want files that have been modified since the time specified.passthrough -
trueorfalseif you want a duplex stream which passes items through and emits globbed files.- Default is
false.
- Default is
sourcemaps -
trueorfalseif you want files to have sourcemaps enabled.- Default is
false.
- Default is
followSymlinks -
trueif you want to recursively resolve symlinks to their targets; set tofalseto preserve them as symlinks.- Default is
true. falsewill makefile.symlinkequal the original symlink's target path.
- Default is
Any glob-related options are documented in glob-stream and node-glob.
Returns a Readable stream by default, or a Duplex stream if the
passthroughoption is set totrue.This stream emits matching vinyl File objects.
Note: UTF-8 BOM will be stripped from all UTF-8 files read with .src.
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().
- Default is
base - Specify the folder relative to the cwd. This is used to determine the file names when saving in
.dest().- Default is the
cwdresolves to the folder path. - Can also be a function that takes in a file and returns a folder path.
- Default is the
mode - Specify the mode the files should be created with.
- Default is the mode of the input file (file.stat.mode) if any.
- Default is the process mode if the input file has no mode property.
dirMode - Specify the mode the directory should be created with.
- Default is the process mode.
overwrite - Specify if existing files with the same path should be overwritten or not.
- Default is
true, to always overwrite existing files.
- 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.
If the file has a
symlinkattribute specifying a target path, then a symlink will be created.The file will be modified after being written to this stream:
cwd,base, andpathwill be overwritten to match the folder.stat.modewill be overwritten if you used a mode parameter.contentswill have it's position reset to the beginning if it is a stream.
symlink(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().
- Default is
base - Specify the folder relative to the cwd. This is used to determine the file names when saving in
.dest().- Default is the
cwdresolves to the folder path. - Can also be a function that takes in a file and returns a folder path.
- Default is the
dirMode - Specify the mode the directory should be created with.
- Default is the process mode.
Returns a Readable/Writable stream.
On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
After creating the symbolic link, 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, andpathwill be overwritten to match the folder.