You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The result of an fs.stat call. See [fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information.
69
+
The result of an fs.stat call. This is how you mark the file as a directory. See[isDirectory()](#isDirectory) and[fs.Stats](http://nodejs.org/api/fs.html#fs_class_fs_stats) for more information.
68
70
69
71
Type: `fs.Stats`<br><br>Default: `null`
70
72
@@ -92,6 +94,15 @@ Returns true if file.contents is a Stream.
92
94
### isNull()
93
95
Returns true if file.contents is null.
94
96
97
+
### isDirectory()
98
+
Returns true if file is a directory. File is considered a directory when:
99
+
100
+
-`file.isNull()` is `true`
101
+
-`file.stat` is an object
102
+
-`file.stat.isDirectory()` returns `true`
103
+
104
+
When constructing a Vinyl object, pass in a valid `fs.Stats` object via `options.stat`. Some operations in Vinyl might need to know the file is a directory from the get go. If you are mocking the `fs.Stats` object, ensure it has the `isDirectory()` method.
105
+
95
106
### clone([opt])
96
107
Returns a new File object with all attributes cloned.<br>By default custom attributes are deep-cloned.
97
108
@@ -124,8 +135,14 @@ if (file.isBuffer()) {
124
135
}
125
136
```
126
137
138
+
### cwd
139
+
Gets and sets current working directory. Defaults to `process.cwd`. Will always be normalized and remove a trailing separator.
140
+
141
+
### base
142
+
Gets and sets base directory. Used for relative pathing (typically where a glob starts). When `null` or `undefined`, it simply proxies the `file.cwd` property. Will always be normalized and remove a trailing separator.
143
+
127
144
### path
128
-
Absolute pathname string or `undefined`. Setting to a different value pushes the old value to `history`.
145
+
Absolute pathname string or `undefined`. Setting to a different value pushes the old value to `history`. All new values are normalized and remove a trailing separator.
129
146
130
147
### history
131
148
Array of `path` values the file object has had, from `history[0]` (original) through `history[history.length - 1]` (current). `history` and its elements should normally be treated as read-only and only altered indirectly by setting `path`.
0 commit comments