mirror of
https://github.com/certd/certd.git
synced 2026-04-25 05:07:25 +08:00
chore: 1
This commit is contained in:
@@ -10,6 +10,12 @@ export type FileStoreOptions = {
|
|||||||
parent: string;
|
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 {
|
export class FileStore {
|
||||||
rootDir: string;
|
rootDir: string;
|
||||||
scope: string;
|
scope: string;
|
||||||
@@ -35,7 +41,7 @@ export class FileStore {
|
|||||||
return localPath;
|
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"));
|
const parentDir = path.join(this.rootDir, this.scope + "", this.parent + "", dayjs().format("YYYY-MM-DD"));
|
||||||
if (!fs.existsSync(parentDir)) {
|
if (!fs.existsSync(parentDir)) {
|
||||||
fs.mkdirSync(parentDir, { recursive: true });
|
fs.mkdirSync(parentDir, { recursive: true });
|
||||||
|
|||||||
Reference in New Issue
Block a user