Comparing version 0.0.8 to 0.0.10
@@ -51,2 +51,6 @@ const fs = require('fs-promise'); | ||
function clean(directory) { | ||
return fs.emptyDir(directory); | ||
} | ||
module.exports = { | ||
@@ -60,2 +64,4 @@ path, | ||
copy, | ||
clean, | ||
empty: clean, | ||
}; |
{ | ||
"name": "io-extra", | ||
"version": "0.0.8", | ||
"version": "0.0.10", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -199,2 +199,3 @@ # io-extra | ||
- [copy](#copy-directory) | ||
- [clean](#clean-directory) | ||
@@ -307,3 +308,21 @@ ### resolve directory fullpath | ||
### clean directory | ||
**clean(directory)** | ||
Cleans directory contents. | ||
If the directory does not exist, it is created. The directory itself is not deleted. | ||
Empty promise is returned. | ||
Alias: `empty()` | ||
Example: | ||
```js | ||
const io = require('io-extra'); | ||
io.directory.clean('/tmp').then(() => console.log('directory cleaned.')); | ||
``` | ||
[1]: https://www.npmjs.org/package/fs-promise | ||
[2]: https://github.com/kevinbeaty/any-promise |
12184
113
327