MCPcopy Create free account
hub / github.com/arctic-cli/interface / cleanup

Function cleanup

packages/arctic/src/util/log.ts:76–88  ·  view source on GitHub ↗
(dir: string)

Source from the content-addressed store, hash-verified

74 }
75
76 async function cleanup(dir: string) {
77 const glob = new Bun.Glob("????-??-??T??????.log")
78 const files = await Array.fromAsync(
79 glob.scan({
80 cwd: dir,
81 absolute: true,
82 }),
83 )
84 if (files.length <= 5) return
85
86 const filesToDelete = files.slice(0, -10)
87 await Promise.all(filesToDelete.map((file) => fs.unlink(file).catch(() => {})))
88 }
89
90 function formatError(error: Error, depth = 0): string {
91 const result = error.message

Callers 1

initFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected