Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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!");
  }
});
Comment

copy folder in nodejs

copydir.sync(from, to[, options]);
Comment

PREVIOUS NEXT
Code Example
Javascript :: get position of element 
Javascript :: javascript select random element from array 
Javascript :: kendo grid get all selected items 
Javascript :: javascript detect click outside element 
Javascript :: reactjs onclick open new page 
Javascript :: trigger click jquery 
Javascript :: map over object javascript 
Javascript :: get input value jquery 
Javascript :: chartjs remove legend 
Javascript :: running a sails js app 
Javascript :: javascript change element class 
Javascript :: string iterate in js 
Javascript :: useeffect will unmount 
Javascript :: reactjs checkbox 
Javascript :: js document.getelementsbyclassname modify innertext 
Javascript :: delete empty values from object js 
Javascript :: nextjs tailwind 
Javascript :: enable select jquery 
Javascript :: refresh page on back button click javascript 
Javascript :: Check if a JavaScript string is a URL 
Javascript :: how to find out if mongoose is connected or not 
Javascript :: open page in new tab using jquery 
Javascript :: javascript remove last character 
Javascript :: background image url react 
Javascript :: bootstrap datetimepicker onchange event 
Javascript :: react native port 
Javascript :: fs get random file in folder 
Javascript :: sweet alert 2 do action on confirm 
Javascript :: string to JSONobject + android 
Javascript :: jquery on blur 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =