var copy = require('{%= name %}');
See the API documentation for usage details and available methods.
The main export is a function that takes:
src
- glob pattern or file path(s)dest
- the destination directorycb
- callback function
copy('*.js', 'foo', function(err, files) {
if (err) throw err;
// `files` is an array of the files that were copied
});
Usage with [gulp][]
In your project's gulpfile.js:
var gulp = require('gulp');
var copy = require('copy');
gulp.task('default', function (cb) {
copy('fixtures/*.txt', 'actual', cb);
});
{%= apidocs("index.js") %}
To use the CLI, install copy
globally with the following command:
$ npm install --global copy
This adds copy
to your system path, allowing the copy
command to be executed anywhere.
CLI usage
$ copy <patterns> <dir>
patterns
: glob pattern or array of file pathsdir
: destination directory
Example
Copy* all files with the .js
extension to the foo
directory
$ copy *.js foo
*Note that glob patterns may need to be wrapped in quotes depending on the shell you're using.
v0.2.0 - breaking changes
- The API was changed in 0.2.0. please review the API documentation