UNPKG

ghost-storage-base

Version:
29 lines 1.22 kB
import type { RequestHandler } from 'express'; declare abstract class StorageBase { readonly requiredFns: readonly ['exists', 'save', 'serve', 'delete', 'read']; storagePath: string; abstract exists(fileName: string, targetDir?: string): Promise<boolean>; abstract save(file: StorageBase.StorageFile, targetDir?: string): Promise<string>; abstract serve(): RequestHandler; abstract delete(fileName: string, targetDir?: string): Promise<void>; abstract read(options: StorageBase.ReadOptions): Promise<Buffer>; abstract saveRaw(buffer: Buffer, targetPath: string): Promise<string>; abstract urlToPath(url: string): string; constructor(); getTargetDir(baseDir?: string | null): string; generateUnique(dir: string, name: string, ext: string | null, i: number): Promise<string>; getUniqueFileName(file: StorageBase.StorageFile, targetDir: string): Promise<string>; getSanitizedFileName(fileName: string): string; } declare namespace StorageBase { type StorageFile = { name: string; path: string; type?: string; }; type ReadOptions = { path: string; }; } export = StorageBase; //# sourceMappingURL=BaseStorage.d.ts.map