diff options
author | Determinant <[email protected]> | 2024-09-09 16:44:44 -0700 |
---|---|---|
committer | Determinant <[email protected]> | 2024-09-09 16:44:44 -0700 |
commit | 4bcbb39b955f1125120f1675ad73492a5e5442ce (patch) | |
tree | 9871de9fed247756b1186beba83e493797943c6d | |
parent | 7b6c61d1c2daa9de9121a09af900c9ea1ec969df (diff) |
group the current version charts with a folder
-rwxr-xr-x | app.mjs | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -238,7 +238,11 @@ for (let r of res) { continue; } const date = cur.date.format("YYYY-MM-DD"); - const file = `${cur.unzip ? zip_path : chart_path}/${r.prefix}-${region.toLowerCase()}-${date}.${cur.unzip ? "zip" : "pdf"}`; + const dir = `${cur.unzip ? zip_path : chart_path}/${date}`; + try { + await fs.mkdir(dir); + } catch (_) {} + const file = `${dir}/${r.prefix}-${region.toLowerCase()}.${cur.unzip ? "zip" : "pdf"}`; const fileExists = (path) => fs.stat(path).then( () => true, @@ -257,7 +261,7 @@ for (let r of res) { await decompress(file, "./", { filter: (f) => cur.unzip[f.path] != null, map: (f) => { - f.path = `${chart_path}/${r.prefix}-${region.toLowerCase()}-${date}${cur.unzip[f.path]}`; + f.path = `${chart_path}/${date}/${r.prefix}-${region.toLowerCase()}${cur.unzip[f.path]}`; return f; }, }); |