Skip to content

Latest commit

 

History

History
74 lines (48 loc) · 1.3 KB

.verb.md

File metadata and controls

74 lines (48 loc) · 1.3 KB

Usage

var copy = require('{%= name %}');

See the API documentation for usage details and available methods.

Examples

The main export is a function that takes:

  • src - glob pattern or file path(s)
  • dest - the destination directory
  • cb - 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);
});

API

{%= apidocs("index.js") %}

CLI

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 paths
  • dir: 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.

History

v0.2.0 - breaking changes