cleanupOldZips() — mcp Function Reference
Architecture documentation for the cleanupOldZips() function in zip-repository.ts from the mcp codebase.
Entity Profile
Dependency Diagram
graph TD 4ac071e8_cf9e_8aff_e8f4_ae8e57382223["cleanupOldZips()"] b00e0b6e_8e66_44d2_f709_c8c6bbb476c9["zip-repository.ts"] 4ac071e8_cf9e_8aff_e8f4_ae8e57382223 -->|defined in| b00e0b6e_8e66_44d2_f709_c8c6bbb476c9 9d72a623_8b26_a485_5797_5f53c18e4294["start()"] 9d72a623_8b26_a485_5797_5f53c18e4294 -->|calls| 4ac071e8_cf9e_8aff_e8f4_ae8e57382223 f7302a04_558c_423c_2b1f_3cfced56f273["warn()"] 4ac071e8_cf9e_8aff_e8f4_ae8e57382223 -->|calls| f7302a04_558c_423c_2b1f_3cfced56f273 33bb86df_1268_373b_a74a_77412144612c["debug()"] 4ac071e8_cf9e_8aff_e8f4_ae8e57382223 -->|calls| 33bb86df_1268_373b_a74a_77412144612c style 4ac071e8_cf9e_8aff_e8f4_ae8e57382223 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
Defined In
Called By
Source
Frequently Asked Questions
What does cleanupOldZips() do?
cleanupOldZips() is a function in the mcp codebase, defined in src/utils/zip-repository.ts.
Where is cleanupOldZips() defined?
cleanupOldZips() is defined in src/utils/zip-repository.ts at line 718.
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