// this will have all of a copy of the normal fs methods as wellvar fs = require('fs.extra');
fs.copy
Creates an fs.readStream and fs.writeStream and uses util.pump to efficiently copy.
fs.copy('foo.txt', 'bar.txt', { replace: false }, function (err) { if (err) { // i.e. file already exists or can't write to directory throw err; } console.log("Copied 'foo.txt' to 'bar.txt');});
Options are optional. replace defaults to false, but will replace existing files if set to true.
fs.copyRecursive
Basically a local rsync, uses fs.copy to recursively copy files and folders (with correct permissions).
fs.copyRecursive('./foo', './bar', function (err) { if (err) { throw err; } console.log("Copied './foo' to './bar');});