root / HServer / 00.Server / 00.Program / node_modules / rmdir / Readme.md
이력 | 보기 | 이력해설 | 다운로드 (2.68 KB)
1 |
# rmdir |
---|---|
2 |
|
3 |
Remove all files in the given path recursively. |
4 |
|
5 |
## Description |
6 |
|
7 |
Or just use `require( 'child_process' ).exec` and call `rm -r` |
8 |
|
9 |
var exec = require('child_process').exec; |
10 |
var path = '/path/to/the/dir'; |
11 |
|
12 |
exec('rm -r ' + path, function (err, stdout, stderr) { |
13 |
// your callback goes here |
14 |
}); |
15 |
|
16 |
## Requires |
17 |
|
18 |
node >= 0.4.x |
19 |
|
20 |
## Installation |
21 |
|
22 |
npm install rmdir |
23 |
|
24 |
## Usage |
25 |
|
26 |
> Require the module before using |
27 |
|
28 |
var rmdir = require('rmdir'); |
29 |
|
30 |
### rmdir(path, [options], [callback]); |
31 |
|
32 |
You can optionally pass in an alternate fs implementation by passing in `options.fs`.Your implementation should have `fs.lstat(path, callback)`, `fs.unlink(path, callback)`, `fs.readdir(path, callback)`, `fs.rmdir(path, callback)`, and `fs.exists(path, callback)` implemented. |
33 |
|
34 |
#### Arguments |
35 |
|
36 |
> path |
37 |
|
38 |
type: String |
39 |
desc: The path to be clear. |
40 |
|
41 |
> options |
42 |
|
43 |
type: Object |
44 |
desc: Options to be used when removing all files. |
45 |
|
46 |
> callback |
47 |
|
48 |
type: Function |
49 |
desc: The callback to be called after all files are removed. |
50 |
arguments: |
51 |
err: |
52 |
type: Error |
53 |
dirs: |
54 |
type: Array |
55 |
desc: The removed dirs. |
56 |
files: |
57 |
type: Array |
58 |
desc: The removed files. |
59 |
|
60 |
#### Example |
61 |
|
62 |
var rmdir = require('rmdir'); |
63 |
var path = '/path/to/the/dir'; |
64 |
|
65 |
rmdir(path + '/assets', function (err, dirs, files) { |
66 |
console.log(dirs); |
67 |
console.log(files); |
68 |
console.log('all files are removed'); |
69 |
}); |
70 |
|
71 |
## Creadit |
72 |
|
73 |
[Aaron Larner](https: //github.com/alarner) |
74 |
[Glen R.Goodwin](https: //github.com/arei) |
75 |
[David Pate](https: //github.com/DavidTPate) |
76 |
[Radare](https://github.com/radare) |
77 |
|
78 |
## License |
79 |
|
80 |
(The MIT License) |
81 |
|
82 |
Copyright(c) 2011 dreamerslab & lt; ben@ dreamerslab.com & gt; |
83 |
|
84 |
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files(the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, |
85 |
distribute, sublicense, and / or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to |
86 |
the following conditions: |
87 |
|
88 |
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. |
89 |
|
90 |
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
91 |
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
92 |
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |