MCPcopy
hub / github.com/tensorflow/tfjs / copyRecursive

Function copyRecursive

link-package/build_deps.ts:206–219  ·  view source on GitHub ↗

* Recursively copy a file or directory. * * @param src The source directory. * @param dest The destination to copy src to.

(src: string, dest: string)

Source from the content-addressed store, hash-verified

204 * @param dest The destination to copy src to.
205 */
206function copyRecursive(src: string, dest: string) {
207 // Avoid 'cp -r', which Windows does not suppport
208 const stat = fs.lstatSync(src);
209 if (stat.isFile()) {
210 fs.copyFileSync(src, dest);
211 } else if (stat.isDirectory()) {
212 const contents = fs.readdirSync(src);
213 fs.mkdirSync(dest);
214 for (let name of contents) {
215 copyRecursive(path.join(src, name),
216 path.join(dest, name));
217 }
218 }
219}
220
221/**
222 * Map a function on all files and directories under a path.

Callers 1

mainFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…