MCPcopy Index your code
hub / github.com/Explosion-Scratch/firebuilder / copyFilesToProfile

Function copyFilesToProfile

helpers/copyFilesToProfile.js:6–23  ·  view source on GitHub ↗
(profilePath, files = [])

Source from the content-addressed store, hash-verified

4import { join, dirname, basename } from "path";
5
6export default function copyFilesToProfile(profilePath, files = []) {
7 const dest = join(profilePath);
8 ensureFolder(dest);
9 for (let file of files) {
10 if (typeof file === "object" && file.content && file.name) {
11 const p = join(dest, file.name);
12 ensureFolder(dirname(p));
13 if (file.append) {
14 ensureFile(p);
15 appendFileSync(p, "\n" + file.content);
16 } else {
17 writeFileSync(p, file.content);
18 }
19 } else {
20 cpSync(file, join(dest, basename(file)));
21 }
22 }
23}

Callers 6

runFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85
handleFunction · 0.85

Calls 2

ensureFolderFunction · 0.90
ensureFileFunction · 0.90

Tested by

no test coverage detected