MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / sub

Function sub

scripts/pack.js:115–130  ·  view source on GitHub ↗
(localDir, toDir)

Source from the content-addressed store, hash-verified

113
114async function addDir(zip, localDir, toDir, filters) {
115 const sub = async (localDir, toDir) => {
116 const files = await fs.readdir(localDir);
117 for (const file of files) {
118 if (filters?.includes(file)) {
119 continue;
120 }
121 const localPath = `${localDir}/${file}`;
122 const toPath = `${toDir}${file}`;
123 const stats = await fs.stat(localPath);
124 if (stats.isDirectory()) {
125 await sub(localPath, `${toPath}/`);
126 } else {
127 await addZipFile(zip, toPath, await fs.readFile(localPath));
128 }
129 }
130 };
131 await sub(localDir, toDir);
132}
133

Callers 1

addDirFunction · 0.85

Calls 1

addZipFileFunction · 0.85

Tested by

no test coverage detected