website/node_modules/fs-extra/docs/copy-sync.md

copySync(src, dest, [options])

Copy a file or directory. The directory can have contents. Like cp -r.

Example:

const fs = require('fs-extra')

// copy file
fs.copySync('/tmp/myfile', '/tmp/mynewfile')

// copy directory, even if it has subdirectories or files
fs.copySync('/tmp/mydir', '/tmp/mynewdir')

Using filter function

const fs = require('fs-extra')

const filterFunc = (src, dest) => {
  // your logic here
  // it will be copied if return true
}

fs.copySync('/tmp/mydir', '/tmp/mynewdir', { filter: filterFunc })


JohnCoene/chirp documentation built on May 25, 2021, 6:33 p.m.