ncp
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|
The npm package "ncp" functions as an asynchronous recursive file and directory copying utility. It operates on the same principle as the command cp -r
, however, it is built entirely on node, and operates asynchronously. It is designed to be utilized both as a Command Line Interface (CLI) tool and programmatically within your codebase.
Utilizing ncp is unexpectedly simple. If you are making use of it from the CLI, your usage would generally follow the format: ncp [source] [dest] [--limit=concurrency limit] [--filter=filter] --stopOnErr
. In this instance, 'source' is your source file or directory, 'dest' is your desired end location, and the other flags are optional. Here is a quick summary of the flags:
ncp
has at a time.ncp
will stop copying if it encounters any errors.As a demonstration, you could use ncp programmatically with the following JavaScript code:
var ncp = require('ncp').ncp;
ncp.limit = 16;
ncp(source, destination, function (err) {
if (err) {
return console.error(err);
}
console.log('done!');
});
In addition, the ncp
function accepts an options dictionary as a third argument providing a wider control over the copying process. Available options include 'filter', 'transform', 'clobber', 'dereference', 'stopOnErr' and 'errs'.
The comprehensive documentation for the use of ncp can be found on its GitHub page at https://github.com/AvianFlu/ncp. The readme file there will guide you through its installation, configuration, and usage, whether you choose to use it from the command line or programmatically.