cleanupOldZips() — mcp Function Reference
Architecture documentation for the cleanupOldZips() function in zip-repository.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD f49e8b0d_0aa2_864b_8309_ab4164c3e67c["cleanupOldZips()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684["start()"] a9363f44_0cfc_87dc_a76a_4eeb9d75c684 -->|calls| f49e8b0d_0aa2_864b_8309_ab4164c3e67c e5352615_c5fb_64a2_cc5c_a248578cbc8a["warn()"] f49e8b0d_0aa2_864b_8309_ab4164c3e67c -->|calls| e5352615_c5fb_64a2_cc5c_a248578cbc8a 69fc7a46_28f6_6b72_2725_66c381e53322["debug()"] f49e8b0d_0aa2_864b_8309_ab4164c3e67c -->|calls| 69fc7a46_28f6_6b72_2725_66c381e53322 style f49e8b0d_0aa2_864b_8309_ab4164c3e67c fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
src/utils/zip-repository.ts lines 718–756
export async function cleanupOldZips(maxAgeMs: number = ZIP_CLEANUP_AGE_MS): Promise<void> {
const tempDir = tmpdir();
const now = Date.now();
try {
const entries = await fs.readdir(tempDir);
let removedCount = 0;
for (const entry of entries) {
// Only process our ZIP files
if (!entry.startsWith('supermodel-') || !entry.endsWith('.zip')) {
continue;
}
const fullPath = join(tempDir, entry);
try {
const stats = await fs.stat(fullPath);
const ageMs = now - stats.mtimeMs;
if (ageMs > maxAgeMs) {
await fs.unlink(fullPath);
removedCount++;
}
} catch (error: any) {
// File might have been deleted already, ignore
if (error.code !== 'ENOENT') {
logger.warn('Failed to cleanup:', fullPath, error.message);
}
}
}
if (removedCount > 0) {
logger.debug('Cleaned up', removedCount, 'old ZIP files');
}
} catch (error: any) {
logger.warn('Failed to cleanup temp directory:', error.message);
}
}
Domain
Subdomains
Called By
Source
Frequently Asked Questions
What does cleanupOldZips() do?
cleanupOldZips() is a function in the mcp codebase.
What does cleanupOldZips() call?
cleanupOldZips() calls 2 function(s): debug, warn.
What calls cleanupOldZips()?
cleanupOldZips() is called by 1 function(s): start.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free