root / HServer / 00.Server / 00.Program / node_modules / mv / README.md
이력 | 보기 | 이력해설 | 다운로드 (831 Bytes)
1 | 39 | HKM | [](http://travis-ci.org/andrewrk/node-mv) |
---|---|---|---|
2 | |||
3 | Usage: |
||
4 | ------ |
||
5 | |||
6 | ```js |
||
7 | var mv = require('mv'); |
||
8 | |||
9 | mv('source/file', 'dest/file', function(err) { |
||
10 | // done. it tried fs.rename first, and then falls back to |
||
11 | // piping the source file to the dest file and then unlinking |
||
12 | // the source file. |
||
13 | }); |
||
14 | ``` |
||
15 | |||
16 | Another example: |
||
17 | |||
18 | ```js |
||
19 | mv('source/dir', 'dest/a/b/c/dir', {mkdirp: true}, function(err) { |
||
20 | // done. it first created all the necessary directories, and then |
||
21 | // tried fs.rename, then falls back to using ncp to copy the dir |
||
22 | // to dest and then rimraf to remove the source dir |
||
23 | }); |
||
24 | ``` |
||
25 | |||
26 | Another example: |
||
27 | |||
28 | ```js |
||
29 | mv('source/file', 'dest/file', {clobber: false}, function(err) { |
||
30 | // done. If 'dest/file' exists, an error is returned |
||
31 | // with err.code === 'EEXIST'. |
||
32 | }); |
||
33 | ``` |