copy directory in nodejs

Solutions on MaxInterview for copy directory in nodejs by the best coders in the world

showing results for - "copy directory in nodejs"
Elisa
22 Aug 2019
1const fse = require('fs-extra');
2
3const srcDir = `path/to/file`;
4const destDir = `path/to/destination/directory`;
5                              
6// To copy a folder or file  
7fse.copySync(srcDir, destDir, function (err) {
8  if (err) {                 ^
9    console.error(err);      |___{ overwrite: true } // add if you want to replace existing folder or file with same name
10  } else {
11    console.log("success!");
12  }
13});
14
Stefania
25 Feb 2016
1copydir.sync(from, to[, options]);