splatoon3.ink/app/common/fs.mjs
Matt Isenhower 7adb9c313e Add mkdirp utility to avoid verbose fs.mkdir calls
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>
2026-02-15 11:09:02 -08:00

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;
}
}