UNPKG

480 BMarkdownView Raw
1# ensureFileSync(file)
2
3Ensures that the file exists. If the file that is requested to be created is in directories that do not exist, these directories are created. If the file already exists, it is **NOT MODIFIED**.
4
5**Alias:** `createFileSync()`
6
7- `file` `<String>`
8
9## Example:
10
11```js
12const fs = require('fs-extra')
13
14const file = '/tmp/this/path/does/not/exist/file.txt'
15fs.ensureFileSync(file)
16// file has now been created, including the directory it is to be placed in
17```