MCPcopy Create free account
hub / github.com/freecodexyz/free-code / removeIfEmpty

Function removeIfEmpty

src/utils/plugins/cacheUtils.ts:179–187  ·  view source on GitHub ↗
(dirPath: string)

Source from the content-addressed store, hash-verified

177}
178
179async function removeIfEmpty(dirPath: string): Promise<void> {
180 if ((await readSubdirs(dirPath)).length === 0) {
181 try {
182 await rm(dirPath, { recursive: true, force: true })
183 } catch (error) {
184 logForDebugging(`Failed to remove empty dir: ${dirPath}: ${error}`)
185 }
186 }
187}
188
189async function readSubdirs(dirPath: string): Promise<string[]> {
190 try {

Calls 3

readSubdirsFunction · 0.85
rmFunction · 0.85
logForDebuggingFunction · 0.85

Tested by

no test coverage detected