mirror of
https://github.com/Shiva108/ai-llm-red-team-handbook.git
synced 2026-10-14 11:41:11 +02:00
adding mermaid packages
This commit is contained in:
1 parent
91dccbba6f
commit
2ec4191721
9491 files changed
+1062059
-1
No files matched your search
+29
@@ -0,0 +1,29 @@
|
||||
# ensureFile(file, [callback])
|
||||
|
||||
Ensures 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**.
|
||||
|
||||
**Alias:** `createFile()`
|
||||
|
||||
- `file` `<String>`
|
||||
- `callback` `<Function>`
|
||||
|
||||
## Example:
|
||||
|
||||
```js
|
||||
const fs = require('fs-extra')
|
||||
|
||||
const file = '/tmp/this/path/does/not/exist/file.txt'
|
||||
fs.ensureFile(file, err => {
|
||||
console.log(err) // => null
|
||||
// file has now been created, including the directory it is to be placed in
|
||||
})
|
||||
|
||||
// With Promises:
|
||||
fs.ensureFile(file)
|
||||
.then(() => {
|
||||
console.log('success!')
|
||||
})
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
})
|
||||
```
|
||||
Reference in new issue
Block a user