MCPcopy Create free account
hub / github.com/GlobalTechInfo/MEGA-MDX / copyRecursive

Function copyRecursive

plugins/update.ts:112–126  ·  view source on GitHub ↗
(src: string, dest: string, ignore: string[] = [], relative: string = '', outList: string[] = [])

Source from the content-addressed store, hash-verified

110}
111
112function copyRecursive(src: string, dest: string, ignore: string[] = [], relative: string = '', outList: string[] = []) {
113 if (!fs.existsSync(dest)) fs.mkdirSync(dest, { recursive: true });
114 for (const entry of fs.readdirSync(src)) {
115 if (ignore.includes(entry)) continue;
116 const s = path.join(src, entry);
117 const d = path.join(dest, entry);
118 const stat = fs.lstatSync(s);
119 if (stat.isDirectory()) {
120 copyRecursive(s, d, ignore, path.join(relative, entry), outList);
121 } else {
122 fs.copyFileSync(s, d);
123 if (outList) outList.push(path.join(relative, entry).replace(/\\/g, '/'));
124 }
125 }
126}
127
128async function updateViaZip(sock: any, chatId: string, message: any, zipOverride: string | null) {
129 const zipUrl = (zipOverride || config.updateZipUrl || process.env.UPDATE_ZIP_URL || '').trim();

Callers 1

updateViaZipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected