import { existsSync, mkdirSync } from 'fs' import path from 'path' import { PATHS } from '../config/paths.js' let tempDir: string | null = null export const getTempDir = (): string => { if (!tempDir) { tempDir = PATHS.TEMP_ROOT if (!existsSync(tempDir)) { mkdirSync(tempDir, { recursive: true }) } } return tempDir } export const getTempFilePath = (filename: string): string => { return path.join(getTempDir(), filename) } export const ensureTempDir = (): string => { return getTempDir() }