Package Exports
- cpr
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cpr) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
CPR (cp -R)
There are other modules out there that attempt this, but none did it the way I needed it to be done or they had issues and the author failed to fix them in a timely manner.
Install
npm install cprBuild Status
Usage
var cpr = require('cpr');
//or
var cpr = require('cpr').cpr; //Back compat
cpr('/path/from', '/path/to', {
deleteFirst: true, //Delete "to" before
overwrite: true, //If the file exists, overwrite it
confirm: true //After the copy, stat all the copied files to make sure they are there
}, function(err, files) {
//err - The error if any (err.list might be available with an array of errors for more detailed information)
//files - List of files that we copied
});
cpr('/path/from', '/path/to', function(err, files) {
//err - The error if any (err.list might be available with an array of errors for more detailed information)
// In the case of an error, cpr continues to copy files but returns this error object with all of the files that it failed to copy.
//files - List of files that we copied
});Options
All options default to false.
deleteFirst: Delete the to directory withrimrafoverwrite: If the destination exists, overwrite itconfirm: After the copy operation, stat all the files and report errors if any are missingfilter:RegExporfunctionto test each file against before copying
Filtering
If you give it a RegExp, it will use that to test the filename as they are being gathered. If it passes, it will be removed.
If you give it a function, it will use that with Array.filter on the list of files.
CLI
cpr can also be used from the command line which is useful for cross platform support.

