mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-03-21 17:54:13 -05:00
Added mkdirp() helper to app/common/fs.mjs that wraps
fs.mkdir(dir, { recursive: true }). Updated all call sites to use it.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
27 lines
485 B
JavaScript
27 lines
485 B
JavaScript
import fs from 'fs/promises';
|
|
|
|
export function mkdirp(dir) {
|
|
return fs.mkdir(dir, { recursive: true });
|
|
}
|
|
|
|
export async function exists(file) {
|
|
try {
|
|
await fs.access(file);
|
|
|
|
return true;
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
// Determine whether a file is older than a given cutoff date (or doesn't exist)
|
|
export async function olderThan(file, cutoff) {
|
|
try {
|
|
let stat = await fs.stat(file);
|
|
|
|
return stat.mtime < cutoff;
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|