Answers for "copy directory in nodejs"

0

copy directory in nodejs

const fse = require('fs-extra');

const srcDir = `path/to/file`;
const destDir = `path/to/destination/directory`;
                              
// To copy a folder or file  
fse.copySync(srcDir, destDir, function (err) {
  if (err) {                 ^
    console.error(err);      |___{ overwrite: true } // add if you want to replace existing folder or file with same name
  } else {
    console.log("success!");
  }
});
Posted by: Guest on July-26-2021
0

copy folder in nodejs

copydir.sync(from, to[, options]);
Posted by: Guest on June-15-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language