Initial commit

This commit is contained in:
2026-03-08 01:34:54 +08:00
commit 1f104f73c8
441 changed files with 64911 additions and 0 deletions

23
api/utils/tempDir.ts Normal file
View File

@@ -0,0 +1,23 @@
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()
}