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
Node fs's mkdir supports mode specification. After reviewing the source
fs-extra does as well, but is not documented. Update the documentation
to include the `options` parameter and provide a few examples of using
`mode`.
Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`.
3
+
Ensures that the directory exists. If the directory structure does not exist, it is created. Like `mkdir -p`. If provided, options may specify the desired mode for the directory.
4
4
5
5
**Aliases:**`mkdirsSync()`, `mkdirpSync()`
6
6
7
7
-`dir``<String>`
8
-
8
+
-`options``<Integer>|<Object>`
9
9
## Example:
10
10
11
11
```js
12
12
constfs=require('fs-extra')
13
13
14
14
constdir='/tmp/this/path/does/not/exist'
15
+
16
+
constdesiredMode=0o2775
17
+
constoptions= {
18
+
mode:0o2775
19
+
}
20
+
15
21
fs.ensureDirSync(dir)
16
22
// dir has now been created, including the directory it is to be placed in
23
+
24
+
fs.ensureDirSync(dir, desiredMod)
25
+
// dir has now been created, including the directory it is to be placed in with permission 0o2775
26
+
27
+
fs.ensureDirSync(dir, options)
28
+
// dir has now been created, including the directory it is to be placed in with permission 0o2775
0 commit comments