我有一个抽象类,我已经扩展了SFTP类型。我还想用AZURE BLOB类型功能扩展这个类。
export abstract class IDataSource {
constructor(public logger: Logger, public debug: boolean) { }
abstract list(path: string): Promise<File[]>;
abstract read(path: string, writeStream: NodeJS.WritableStream): Promise<void>;
abstract write(path: string, readStream: NodeJS.ReadableStream): Promise<void>;
abstract createReadStream(path: string): Promise<Readable>;
abstract createWriteStream(path: string): Promise<Writable>;
abstract close(): Promise<void>;
abstract exists(path: string, isFile: boolean): Promise<boolean>;
abstract delete(path: string): Promise<void>;
abstract removeDir(path: string): Promise<void>;
abstract makeDir(path: string, recursive: boolean): Promise<void>;
abstract cwd(): Promise<string>;
}
如何使用抽象方法实现blob存储相关功能。
1条答案
按热度按时间p4rjhz4m1#
我引用了MSDOC和CreateWriteStream来上传给定的内容文本到blob。
使用createReadStream Output:
Azure:
其他方法:
输出:
Azure:
阅读bolb中的内容:
输出: