1 import { stat } from 'fs-extra'
3 async function mtimeSortFilesDesc (files: string[], basePath: string) {
5 const out: { file: string, mtime: number }[] = []
7 for (const file of files) {
8 const p = stat(basePath + '/' + file)
10 if (stats.isFile()) out.push({ file, mtime: stats.mtime.getTime() })
16 await Promise.all(promises)
18 out.sort((a, b) => b.mtime - a.mtime)