aboutsummaryrefslogtreecommitdiff
path: root/node_modules/fs-extra/docs/emptyDir.md
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/fs-extra/docs/emptyDir.md')
-rw-r--r--node_modules/fs-extra/docs/emptyDir.md30
1 files changed, 30 insertions, 0 deletions
diff --git a/node_modules/fs-extra/docs/emptyDir.md b/node_modules/fs-extra/docs/emptyDir.md
new file mode 100644
index 0000000..6553e9a
--- /dev/null
+++ b/node_modules/fs-extra/docs/emptyDir.md
@@ -0,0 +1,30 @@
+# emptyDir(dir, [callback])
+
+Ensures that a directory is empty. Deletes directory contents if the directory is not empty. If the directory does not exist, it is created. The directory itself is not deleted.
+
+**Alias:** `emptydir()`
+
+- `dir` `<String>`
+- `callback` `<Function>`
+
+## Example:
+
+```js
+const fs = require('fs-extra')
+
+// assume this directory has a lot of files and folders
+fs.emptyDir('/tmp/some/dir', err => {
+ if (err) return console.error(err)
+
+ console.log('success!')
+})
+
+// With promises
+fs.emptyDir('/tmp/some/dir')
+.then(() => {
+ console.log('success!')
+})
+.catch(err => {
+ console.error(err)
+})
+```