Filesystem.cp()

Copy file or directory located at source path to the destination path.

Includes all of its descendant files and directories (i.e. `cp -r`). Any existing file at the destination path will be overwritten.

Usage

Hover over inputs/exits for more info.

var Filesystem = require('machinepack-fs');


// Copy file or directory located at source path to the destination path.

Filesystem.cp({

source: '/Users/mikermcneil/.tmp/foo',

destination: '/Users/mikermcneil/.tmp/bar',

}).exec({

// An unexpected error occurred.

error: function (err) {

 

},

// No file or folder could be found at the provided source path.

doesNotExist: function () {

 

},

// OK.

success: function () {

 

},

});

Inputs

source required

The path (relative or absolute) to the file or directory to copy.

'/Users/mikermcneil/.tmp/foo'
destination required

The path (relative or absolute) to the directory in which to place the copied file(s).

'/Users/mikermcneil/.tmp/bar'

Exits

error

An unexpected error occurred.

doesNotExist

No file or folder could be found at the provided source path.

success

OK.