Browse Source

readme: emptyDir()

ci/travis-osximage
JP Richardson 10 years ago
parent
commit
bada977aa5
  1. 21
      README.md

21
README.md

@ -107,6 +107,27 @@ better succinct nomenclature for these methods, please open an issue for discuss
### emptyDir(dir, [callback])
Ensures that a directory is empty. If the directory does not exist, it is created. The directory itself is not deleted.
Alias: `emptydir()`
Sync: `emptyDirSync()`, `emptydirSync()`
Example:
```js
var fs = require('fs-extra')
// assume this directory has a lot of files and folders
fs.emptyDir('/tmp/some/dir', function (err) {
if (!err) console.log('success!')
})
```
### ensureFile(file, callback) ### 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**. 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**.

Loading…
Cancel
Save