fix: ensure cache directory exists

This commit is contained in:
Wesley F. Young 2024-09-07 10:34:20 +08:00
parent 897e5a6f61
commit 405e8d9d92
2 changed files with 4 additions and 0 deletions

View File

@ -23,6 +23,7 @@
"@types/express": "^4.17.21",
"@types/figlet": "^1.5.8",
"@types/fluent-ffmpeg": "^2.1.24",
"@types/fs-extra": "^11.0.4",
"@types/jest": "^29.5.12",
"@types/node": "^22.0.1",
"@types/qrcode-terminal": "^0.12.2",
@ -54,6 +55,7 @@
"fast-xml-parser": "^4.3.6",
"file-type": "^19.0.0",
"fluent-ffmpeg": "^2.1.2",
"fs-extra": "^11.2.0",
"image-size": "^1.1.1",
"json-schema-to-ts": "^3.1.0",
"log4js": "^6.9.1",

View File

@ -6,6 +6,7 @@ import fs from 'fs';
import fsPromises from 'fs/promises';
import { httpDownload } from '@/common/file';
import { randomUUID } from 'crypto';
import fsExtra from 'fs-extra';
export class LaanaFileUtils {
cacheDir = path.join(this.laana.pathWrapper.cachePath, 'laana');
@ -14,6 +15,7 @@ export class LaanaFileUtils {
public core: NapCatCore,
public laana: NapCatLaanaAdapter,
) {
fsExtra.ensureDirSync(this.cacheDir);
}
async resolveCacheIdFromLaanaFile(laanaFile: LaanaFile) {