Comparing version 0.1.0 to 0.2.0
11
index.js
@@ -58,2 +58,3 @@ 'use strict'; | ||
force: false, | ||
silent: false, | ||
}, config || {}); | ||
@@ -88,6 +89,8 @@ | ||
p = p.fail(function (e) { | ||
config.stderr.write(e.message + '\n'); | ||
throw e; | ||
}); | ||
if (!config.silent) { | ||
p = p.fail(function (e) { | ||
config.stderr.write(e.message + '\n'); | ||
throw e; | ||
}); | ||
} | ||
@@ -94,0 +97,0 @@ return p; |
{ | ||
"name": "safe-wipe", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/themeleon/safe-wipe", |
@@ -21,19 +21,20 @@ # safe-wipe [![npm version](http://img.shields.io/npm/v/safe-wipe.svg?style=flat-square)](https://www.npmjs.org/package/safe-wipe) | ||
* `stdin`, `stdout`, `stderr`: streams to use for I/O. Defaults to | ||
the `process` streams. | ||
* `ignore`: an array of files to ignore when checking if a directory is | ||
empty. Defaults to `.DS_Store` and `Thumbs.db`. | ||
* `parent`: a (supposed) parent directory of the directory to wipe. If | ||
the parent is contained in the directory to wipe, the process will be | ||
aborted in all cases. | ||
* `interactive`: whether the session is interactive. `true` by default. | ||
* `force`: whether to force the wipe if the folder is not empty. `false` | ||
by default. | ||
* `messages`: an object of messages for user prompt and error display. | ||
* `contained`: error message when the folder to wipe is contained in | ||
the configured parent folder. | ||
* `confirm`: text to prompt the user to confirm the (not empty) | ||
directory wipe. | ||
* `abort`: error message when the user refuses to wipe the folder. | ||
| Name | Description | | ||
| ---- | ----------- | | ||
| `stdin`, `stdout`, `stderr` | Streams to use for I/O. Defaults to the `process` streams. | | ||
| `ignore` | An array of files to ignore when checking if a directory is empty. Defaults to `.DS_Store` and `Thumbs.db`. | | ||
| `parent` | A (supposed) parent directory of the directory to wipe. If the parent is contained in the directory to wipe, the process will be aborted in all cases. | | ||
| `interactive` | Whether the session is interactive. `true` by default. | | ||
| `force` | Whether to force the wipe if the folder is not empty. `false` by default. | | ||
| `silent` | The error messages are not printed if this is et to `true`. `false` by default. | | ||
| `messages` | An object of messages for user prompt and error display. | | ||
The messages are: | ||
| Name | Description | | ||
| ---- | ----------- | | ||
| `contained` | Error message when the folder to wipe is contained in the configured parent folder. | | ||
| `confirm` | Text to prompt the user to confirm the (not empty) directory wipe. | | ||
| `abort` | Error message when the user refuses to wipe the folder. | | ||
The function is asynchronous and return a promise. Nothing is passed to | ||
@@ -43,6 +44,6 @@ the success function, but you'll get an `Error` instance in the error | ||
* `CONTAINED`: refused to remove the directory since it's containing the | ||
supposed parent. | ||
* `ABORT`: the user aborted the operation (or we're not in an | ||
interactive session and `config.force` is `false`). | ||
| Code | Description | | ||
| ---- | ----------- | | ||
| `CONTAINED` | Refused to remove the directory since it's containing the supposed parent. | | ||
| `ABORT` | The user aborted the operation (or we're not in an interactive session and `config.force` is `false`). | | ||
@@ -49,0 +50,0 @@ Examples |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9589
187
83