root / HServer / 00.Server / 00.Program / node_modules / rimraf / README.md
이력 | 보기 | 이력해설 | 다운로드 (1.88 KB)
1 | 39 | HKM | [](https://travis-ci.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf) [](https://david-dm.org/isaacs/rimraf#info=devDependencies) |
---|---|---|---|
2 | |||
3 | The [UNIX command](http://en.wikipedia.org/wiki/Rm_(Unix)) `rm -rf` for node. |
||
4 | |||
5 | Install with `npm install rimraf`, or just drop rimraf.js somewhere. |
||
6 | |||
7 | ## API |
||
8 | |||
9 | `rimraf(f, [opts], callback)` |
||
10 | |||
11 | The first parameter will be interpreted as a globbing pattern for files. If you |
||
12 | want to disable globbing you can do so with `opts.disableGlob` (defaults to |
||
13 | `false`). This might be handy, for instance, if you have filenames that contain |
||
14 | globbing wildcard characters. |
||
15 | |||
16 | The callback will be called with an error if there is one. Certain |
||
17 | errors are handled for you: |
||
18 | |||
19 | * Windows: `EBUSY` and `ENOTEMPTY` - rimraf will back off a maximum of |
||
20 | `opts.maxBusyTries` times before giving up, adding 100ms of wait |
||
21 | between each attempt. The default `maxBusyTries` is 3. |
||
22 | * `ENOENT` - If the file doesn't exist, rimraf will return |
||
23 | successfully, since your desired outcome is already the case. |
||
24 | * `EMFILE` - Since `readdir` requires opening a file descriptor, it's |
||
25 | possible to hit `EMFILE` if too many file descriptors are in use. |
||
26 | In the sync case, there's nothing to be done for this. But in the |
||
27 | async case, rimraf will gradually back off with timeouts up to |
||
28 | `opts.emfileWait` ms, which defaults to 1000. |
||
29 | |||
30 | ## rimraf.sync |
||
31 | |||
32 | It can remove stuff synchronously, too. But that's not so good. Use |
||
33 | the async API. It's better. |
||
34 | |||
35 | ## CLI |
||
36 | |||
37 | If installed with `npm install rimraf -g` it can be used as a global |
||
38 | command `rimraf <path> [<path> ...]` which is useful for cross platform support. |
||
39 | |||
40 | ## mkdirp |
||
41 | |||
42 | If you need to create a directory recursively, check out |
||
43 | [mkdirp](https://github.com/substack/node-mkdirp). |