* Given a reverse chronological array of paths * This deletes all files except for n of them * * n is the (1 indexed) count of files to keep.
(basePath, paths, n)
| 109 | * n is the (1 indexed) count of files to keep. |
| 110 | */ |
| 111 | function keep (basePath, paths, n) { |
| 112 | |
| 113 | for (let i = paths.length; i > n; i--) { |
| 114 | fs.removeSync(path.resolve(basePath, paths[i - 1])); |
| 115 | } |
| 116 | } |
| 117 | |
| 118 | function cleanPath (tmpPath) { |
| 119 | fs.removeSync(tmpPath); |