From 4813872bccb20bc652149a2b076660f95729076b Mon Sep 17 00:00:00 2001 From: xiaojunnuo Date: Wed, 17 Jul 2024 01:33:55 +0800 Subject: [PATCH] chore: 1 --- packages/core/pipeline/src/core/file-store.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/core/pipeline/src/core/file-store.ts b/packages/core/pipeline/src/core/file-store.ts index de1b1ed6..bca4ea8d 100644 --- a/packages/core/pipeline/src/core/file-store.ts +++ b/packages/core/pipeline/src/core/file-store.ts @@ -10,6 +10,12 @@ export type FileStoreOptions = { parent: string; }; +export interface IFileStore { + readFile(filePath: string): Buffer | null; + writeFile(filename: string, file: Buffer): string; + deleteByParent(scope: string, parent: string): void; +} + export class FileStore { rootDir: string; scope: string; @@ -35,7 +41,7 @@ export class FileStore { return localPath; } - private buildFilePath(filename: string) { + protected buildFilePath(filename: string) { const parentDir = path.join(this.rootDir, this.scope + "", this.parent + "", dayjs().format("YYYY-MM-DD")); if (!fs.existsSync(parentDir)) { fs.mkdirSync(parentDir, { recursive: true });