There is no function in the fs object that will copy the entire directory. There is not even one that will copy the entire file.
However, this is a quick and easy way to copy a single file.
var fs = require('fs'); fs.createReadStream('input_filename').pipe(fs.createWriteStream('output_filename'));
Now you just need to get a list of directories. You would use fs.readdir or fs.readdirSync .
So, to copy the directory to another, you can do something like this:
var dir = fs.readdirSync('.'); for (var i=0; i < dir.length; i++) { fs.createReadStream(dir[i]).pipe(fs.createWriteStream("newpath/"+dir[i])); }
source share