MCPcopy Index your code
hub / github.com/serverless/serverless / copyDirContents

Function copyDirContents

packages/sf-core/src/utils/fs/index.js:103–122  ·  view source on GitHub ↗
(srcDir, destDir, { noLinks = false } = {})

Source from the content-addressed store, hash-verified

101 * @param options Options for copying, including noLinks to exclude symbolic links.
102 */
103const copyDirContents = async (srcDir, destDir, { noLinks = false } = {}) => {
104 const entries = await fsp.readdir(srcDir, { withFileTypes: true })
105
106 await fsp.mkdir(destDir, { recursive: true })
107
108 for (const entry of entries) {
109 const srcPath = path.join(srcDir, entry.name)
110 const destPath = path.join(destDir, entry.name)
111
112 if (noLinks && entry.isSymbolicLink()) {
113 continue
114 }
115
116 if (entry.isDirectory()) {
117 await copyDirContents(srcPath, destPath, { noLinks })
118 } else {
119 await fsp.copyFile(srcPath, destPath)
120 }
121 }
122}
123
124/**
125 * Recursively removes a file or directory.

Callers 2

downloadTemplateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…