(p: string)
| 87 | .catch(error('readdir')) |
| 88 | |
| 89 | const pruneDirectory = async (p: string) => { |
| 90 | const all = await getLogFilesIn(p) |
| 91 | |
| 92 | if (all && all.length > MaxRetainedLogFiles) { |
| 93 | const end = all.length - MaxRetainedLogFiles + 1 |
| 94 | const old = all.sort().slice(0, end) |
| 95 | |
| 96 | for (const f of old) { |
| 97 | await unlink(join(p, f.name)).catch(error('unlink')) |
| 98 | } |
| 99 | } |
| 100 | } |
no test coverage detected