MCPcopy Create free account
hub / github.com/Noumena-Network/code / unlinkIfOld

Function unlinkIfOld

src/utils/cleanup.ts:135–146  ·  view source on GitHub ↗
(
  filePath: string,
  cutoffDate: Date,
  fsImpl: FsOperations,
)

Source from the content-addressed store, hash-verified

133}
134
135async function unlinkIfOld(
136 filePath: string,
137 cutoffDate: Date,
138 fsImpl: FsOperations,
139): Promise<boolean> {
140 const stats = await fsImpl.stat(filePath)
141 if (stats.mtime < cutoffDate) {
142 await fsImpl.unlink(filePath)
143 return true
144 }
145 return false
146}
147
148async function tryRmdir(dirPath: string, fsImpl: FsOperations): Promise<void> {
149 try {

Callers 3

cleanupOldSessionFilesFunction · 0.85
cleanupSingleDirectoryFunction · 0.85
cleanupOldDebugLogsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected