refactor: parallel rm()

This commit is contained in:
MDLeom 2024-10-27 07:06:04 +00:00
parent 58e50a2f85
commit d7145f19e1
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 3 additions and 3 deletions

View File

@ -58,14 +58,14 @@ const f = async () => {
}
// Cloudflare Pages has maximum file size of 25MiB
const files = await readdir(publicPath)
if (process.env.CF_PAGES) {
const files = await readdir(publicPath)
for (const filename of files) {
await Promise.all(files.map(async (filename) => {
const { size } = await stat(join(publicPath, filename))
if (size >= (25 * 1024 * 1024)) {
await rm(join(publicPath, filename), { force: true })
}
}
}))
}
}