1
1
# vinyl-fs [ ![ NPM version] [ npm-image ]] [ npm-url ] [ ![ Build Status] [ travis-image ]] [ travis-url ] [ ![ Coveralls Status] [ coveralls-image ]] [ coveralls-url ] [ ![ Dependency Status] [ depstat-image ]] [ depstat-url ]
2
-
3
2
## Information
4
-
5
3
<table >
6
4
<tr >
7
5
<td >Package</td ><td >vinyl-fs</td >
@@ -33,9 +31,7 @@ fs.src(['./js/**/*.js', '!./js/vendor/*.js'])
33
31
```
34
32
35
33
## API
36
-
37
34
### src(globs[ , opt] )
38
-
39
35
- Takes a glob string or an array of glob strings as the first argument.
40
36
- Globs are executed in order, so negations should follow positive globs. For example:
41
37
@@ -52,54 +48,54 @@ fs.src(['*.js', '!b*.js'])
52
48
- Possible options for the second argument:
53
49
- cwd - Specify the working directory the folder is relative to.
54
50
- Default is ` process.cwd() ` .
51
+
55
52
- base - Specify the folder relative to the cwd. This is used to determine the file names when saving in ` .dest() ` .
56
53
- Default is where the glob begins if any.
57
54
- Default is ` process.cwd() ` if there is no glob.
55
+
58
56
- buffer - ` true ` or ` false ` if you want to buffer the file.
59
57
- Default value is ` true ` .
60
58
- ` false ` will make ` file.contents ` a paused Stream.
59
+
61
60
- read - ` true ` or ` false ` if you want the file to be read or not. Useful for stuff like ` rm ` ing files.
62
61
- Default value is ` true ` .
63
62
- ` false ` will disable writing the file to disk via ` .dest() ` .
63
+
64
64
- since - ` Date ` or ` number ` if you only want files that have been modified since the time specified.
65
65
- passthrough - ` true ` or ` false ` if you want a duplex stream which passes items through and emits globbed files.
66
66
- Default is ` false ` .
67
+
67
68
- sourcemaps - ` true ` or ` false ` if you want files to have sourcemaps enabled.
68
69
- Default is ` false ` .
70
+
69
71
- Any glob-related options are documented in [ glob-stream] and [ node-glob] .
72
+
70
73
- Returns a Readable stream by default, or a Duplex stream if the ` passthrough ` option is set to ` true ` .
71
74
- This stream emits matching [ vinyl] File objects.
72
75
73
- _ Note:_ UTF-8 BOM will be stripped from all files read with ` .src ` .
74
-
75
- ### watch(globs[ , opt, cb] )
76
-
77
- This is just [ glob-watcher] .
78
-
79
- - Takes a glob string or an array of glob strings as the first argument.
80
- - Possible options for the second argument:
81
- - Any options are passed to [ gaze] .
82
- - Returns an EventEmitter.
83
- - 'changed' event is emitted on each file change.
84
- - Optionally calls the callback on each change event.
76
+ _ Note:_ UTF-8 BOM will be stripped from all UTF-8 files read with ` .src ` .
85
77
86
78
### dest(folder[ , opt] )
87
-
88
79
- Takes a folder path as the first argument.
89
80
- First argument can also be a function that takes in a file and returns a folder path.
90
81
- Possible options for the second argument:
91
82
- cwd - Specify the working directory the folder is relative to.
92
83
- Default is ` process.cwd() ` .
84
+
93
85
- base - Specify the folder relative to the cwd. This is used to determine the file names when saving in ` .dest() ` .
94
86
- Default is the ` cwd ` resolves to the folder path.
95
87
- Can also be a function that takes in a file and returns a folder path.
88
+
96
89
- mode - Specify the mode the files should be created with.
97
90
- Default is the mode of the input file (file.stat.mode) if any.
98
91
- Default is the process mode if the input file has no mode property.
92
+
99
93
- dirMode - Specify the mode the directory should be created with.
100
94
- Default is the process mode.
95
+
101
96
- overwrite - Specify if existing files with the same path should be overwritten or not.
102
97
- Default is ` true ` , to always overwrite existing files.
98
+
103
99
- Returns a Readable/Writable stream.
104
100
- On write the stream will save the [ vinyl] File to disk at the folder/cwd specified.
105
101
- After writing the file to disk, it will be emitted from the stream so you can keep piping these around.
@@ -109,16 +105,18 @@ This is just [glob-watcher].
109
105
- ` contents ` will have it's position reset to the beginning if it is a stream.
110
106
111
107
### symlink(folder[ , opt] )
112
-
113
108
- Takes a folder path as the first argument.
114
109
- First argument can also be a function that takes in a file and returns a folder path.
115
110
- Possible options for the second argument:
116
111
- cwd - Specify the working directory the folder is relative to.
117
112
- Default is ` process.cwd() ` .
113
+
118
114
- base - Specify the folder relative to the cwd. This is used to determine the file names when saving in ` .dest() ` .
119
115
- Default is the ` cwd ` resolves to the folder path.
116
+
120
117
- dirMode - Specify the mode the directory should be created with.
121
118
- Default is the process mode.
119
+
122
120
- Returns a Readable/Writable stream.
123
121
- On write the stream will create a symbolic link (i.e. symlink) on disk at the folder/cwd specified.
124
122
- After creating the symbolic link, it will be emitted from the stream so you can keep piping these around.
@@ -130,7 +128,6 @@ This is just [glob-watcher].
130
128
[ gaze ] : https://github.com/shama/gaze
131
129
[ glob-watcher ] : https://github.com/wearefractal/glob-watcher
132
130
[ vinyl ] : https://github.com/wearefractal/vinyl
133
-
134
131
[ npm-url ] : https://www.npmjs.com/package/vinyl-fs
135
132
[ npm-image ] : https://badge.fury.io/js/vinyl-fs.svg
136
133
[ travis-url ] : https://travis-ci.org/wearefractal/vinyl-fs
0 commit comments