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

Function copyRecursive

plugins/update.js:113–131  ·  view source on GitHub ↗
(src, dest, ignore = [], relative = '', outList = [])

Source from the content-addressed store, hash-verified

111 throw new Error("No system unzip tool found (unzip/7z/busybox). Git mode is recommended on this panel.");
112}
113function copyRecursive(src, dest, ignore = [], relative = '', outList = []) {
114 if (!fs.existsSync(dest))
115 fs.mkdirSync(dest, { recursive: true });
116 for (const entry of fs.readdirSync(src)) {
117 if (ignore.includes(entry))
118 continue;
119 const s = path.join(src, entry);
120 const d = path.join(dest, entry);
121 const stat = fs.lstatSync(s);
122 if (stat.isDirectory()) {
123 copyRecursive(s, d, ignore, path.join(relative, entry), outList);
124 }
125 else {
126 fs.copyFileSync(s, d);
127 if (outList)
128 outList.push(path.join(relative, entry).replace(/\\/g, '/'));
129 }
130 }
131}
132async function updateViaZip(sock, chatId, message, zipOverride) {
133 const zipUrl = (zipOverride || config.updateZipUrl || process.env.UPDATE_ZIP_URL || '').trim();
134 if (!zipUrl) {

Callers 1

updateViaZipFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected