import { Readable, Writable } from 'stream'; import { BucketFile, BucketType } from './types'; // Note: right now use generic default with F (file) any export interface Driver { type: BucketType; name: string; toFile(orgFile: F): Omit; /** Return the path of a cloud "file object" */ getPath(obj: F): string; exists(path: string): Promise; /** * Get and return a BucketFile for a given path (will do a cloud bucket query). * Returns null if not found. Throw exception if any other exception than notfound. */ getCloudFile(path: String): Promise; listCloudFiles(opts: ListCloudFilesOptions): Promise; downloadCloudFile(cf: F, localPath: string): Promise; uploadCloudFile(localFilePath: string, remoteFilePath: string, contentType?: string): Promise; copyCloudFile(cf: F, destDir: BucketFile): Promise; deleteCloudFile(path: string): Promise; downloadAsText(path: string): Promise uploadCloudContent(path: string, content: string, contentType?: string): Promise; createReadStream(path: string): Promise; createWriteStream(path: string): Promise; } /** Internal Interface to the list implementation */ export interface ListCloudFilesOptions { prefix?: string; // the prefix (only) glob?: string; // the eventual glob delimiter?: boolean; // if true, the '/' delimiter will be set (might allow to set specific char later) }