rimraf 2.4.4 → 2.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/package.json +3 -3
- package/rimraf.js +7 -5
package/README.md
CHANGED
|
@@ -27,6 +27,64 @@ errors are handled for you:
|
|
|
27
27
|
async case, rimraf will gradually back off with timeouts up to
|
|
28
28
|
`opts.emfileWait` ms, which defaults to 1000.
|
|
29
29
|
|
|
30
|
+
## options
|
|
31
|
+
|
|
32
|
+
* unlink, chmod, stat, lstat, rmdir, readdir,
|
|
33
|
+
unlinkSync, chmodSync, statSync, lstatSync, rmdirSync, readdirSync
|
|
34
|
+
|
|
35
|
+
In order to use a custom file system library, you can override
|
|
36
|
+
specific fs functions on the options object.
|
|
37
|
+
|
|
38
|
+
If any of these functions are present on the options object, then
|
|
39
|
+
the supplied function will be used instead of the default fs
|
|
40
|
+
method.
|
|
41
|
+
|
|
42
|
+
Sync methods are only relevant for `rimraf.sync()`, of course.
|
|
43
|
+
|
|
44
|
+
For example:
|
|
45
|
+
|
|
46
|
+
```javascript
|
|
47
|
+
var myCustomFS = require('some-custom-fs')
|
|
48
|
+
|
|
49
|
+
rimraf('some-thing', myCustomFS, callback)
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
* maxBusyTries
|
|
53
|
+
|
|
54
|
+
If an `EBUSY`, `ENOTEMPTY`, or `EPERM` error code is encountered
|
|
55
|
+
on Windows systems, then rimraf will retry with a linear backoff
|
|
56
|
+
wait of 100ms longer on each try. The default maxBusyTries is 3.
|
|
57
|
+
|
|
58
|
+
Only relevant for async usage.
|
|
59
|
+
|
|
60
|
+
* emfileWait
|
|
61
|
+
|
|
62
|
+
If an `EMFILE` error is encountered, then rimraf will retry
|
|
63
|
+
repeatedly with a linear backoff of 1ms longer on each try, until
|
|
64
|
+
the timeout counter hits this max. The default limit is 1000.
|
|
65
|
+
|
|
66
|
+
If you repeatedly encounter `EMFILE` errors, then consider using
|
|
67
|
+
[graceful-fs](http://npm.im/graceful-fs) in your program.
|
|
68
|
+
|
|
69
|
+
Only relevant for async usage.
|
|
70
|
+
|
|
71
|
+
* glob
|
|
72
|
+
|
|
73
|
+
Set to `false` to disable [glob](http://npm.im/glob) pattern
|
|
74
|
+
matching.
|
|
75
|
+
|
|
76
|
+
Set to an object to pass options to the glob module. The default
|
|
77
|
+
glob options are `{ nosort: true, silent: true }`.
|
|
78
|
+
|
|
79
|
+
Glob version 6 is used in this module.
|
|
80
|
+
|
|
81
|
+
Relevant for both sync and async usage.
|
|
82
|
+
|
|
83
|
+
* disableGlob
|
|
84
|
+
|
|
85
|
+
Set to any non-falsey value to disable globbing entirely.
|
|
86
|
+
(Equivalent to setting `glob: false`.)
|
|
87
|
+
|
|
30
88
|
## rimraf.sync
|
|
31
89
|
|
|
32
90
|
It can remove stuff synchronously, too. But that's not so good. Use
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rimraf",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.5.2",
|
|
4
4
|
"main": "rimraf.js",
|
|
5
5
|
"description": "A deep deletion module for node (like `rm -rf`)",
|
|
6
6
|
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"bin": "./bin.js",
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"glob": "^
|
|
14
|
+
"glob": "^7.0.0"
|
|
15
15
|
},
|
|
16
16
|
"files": [
|
|
17
17
|
"LICENSE",
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
],
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"mkdirp": "^0.5.1",
|
|
24
|
-
"tap": "^1.
|
|
24
|
+
"tap": "^5.1.1"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/rimraf.js
CHANGED
|
@@ -6,10 +6,8 @@ var path = require("path")
|
|
|
6
6
|
var fs = require("fs")
|
|
7
7
|
var glob = require("glob")
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var defaultGlobOpts = {
|
|
10
10
|
nosort: true,
|
|
11
|
-
nocomment: true,
|
|
12
|
-
nonegate: true,
|
|
13
11
|
silent: true
|
|
14
12
|
}
|
|
15
13
|
|
|
@@ -35,7 +33,11 @@ function defaults (options) {
|
|
|
35
33
|
|
|
36
34
|
options.maxBusyTries = options.maxBusyTries || 3
|
|
37
35
|
options.emfileWait = options.emfileWait || 1000
|
|
36
|
+
if (options.glob === false) {
|
|
37
|
+
options.disableGlob = true
|
|
38
|
+
}
|
|
38
39
|
options.disableGlob = options.disableGlob || false
|
|
40
|
+
options.glob = options.glob || defaultGlobOpts
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
function rimraf (p, options, cb) {
|
|
@@ -63,7 +65,7 @@ function rimraf (p, options, cb) {
|
|
|
63
65
|
if (!er)
|
|
64
66
|
return afterGlob(null, [p])
|
|
65
67
|
|
|
66
|
-
glob(p,
|
|
68
|
+
glob(p, options.glob, afterGlob)
|
|
67
69
|
})
|
|
68
70
|
|
|
69
71
|
function next (er) {
|
|
@@ -270,7 +272,7 @@ function rimrafSync (p, options) {
|
|
|
270
272
|
fs.lstatSync(p)
|
|
271
273
|
results = [p]
|
|
272
274
|
} catch (er) {
|
|
273
|
-
results = glob.sync(p,
|
|
275
|
+
results = glob.sync(p, options.glob)
|
|
274
276
|
}
|
|
275
277
|
}
|
|
276
278
|
|