Bug:Fix file validation issue
[vnfsdk/refrepo.git] / vnfmarket / src / main / webapp / vnfmarket / node_modules / ncp / README.md
1 # ncp - Asynchronous recursive file & directory copying
2
3 [![Build Status](https://secure.travis-ci.org/AvianFlu/ncp.png)](http://travis-ci.org/AvianFlu/ncp)
4
5 Think `cp -r`, but pure node, and asynchronous.  `ncp` can be used both as a CLI tool and programmatically.
6
7 ## Command Line usage
8
9 Usage is simple: `ncp [source] [dest] [--limit=concurrency limit]
10 [--filter=filter] --stopOnErr`
11
12 The 'filter' is a Regular Expression - matched files will be copied.
13
14 The 'concurrency limit' is an integer that represents how many pending file system requests `ncp` has at a time.
15
16 'stopOnErr' is a boolean flag that will tell `ncp` to stop immediately if any
17 errors arise, rather than attempting to continue while logging errors.
18
19 If there are no errors, `ncp` will output `done.` when complete.  If there are errors, the error messages will be logged to `stdout` and to `./ncp-debug.log`, and the copy operation will attempt to continue.
20
21 ## Programmatic usage
22
23 Programmatic usage of `ncp` is just as simple.  The only argument to the completion callback is a possible error.  
24
25 ```javascript
26 var ncp = require('ncp').ncp;
27
28 ncp.limit = 16;
29
30 ncp(source, destination, function (err) {
31  if (err) {
32    return console.error(err);
33  }
34  console.log('done!');
35 });
36 ```
37
38 You can also call ncp like `ncp(source, destination, options, callback)`. 
39 `options` should be a dictionary. Currently, such options are available:
40
41   * `options.filter` - a `RegExp` instance, against which each file name is
42   tested to determine whether to copy it or not, or a function taking single
43   parameter: copied file name, returning `true` or `false`, determining
44   whether to copy file or not.
45
46   * `options.transform` - a function: `function (read, write) { read.pipe(write) }`
47   used to apply streaming transforms while copying.
48
49   * `options.clobber` - boolean=true. if set to false, `ncp` will not overwrite 
50   destination files that already exist.
51
52 Please open an issue if any bugs arise.  As always, I accept (working) pull requests, and refunds are available at `/dev/null`.