From d2616207a489a60c497285f181d67ccd4ac722cb Mon Sep 17 00:00:00 2001 From: fantasticit Date: Tue, 19 Jul 2022 13:55:48 +0800 Subject: [PATCH] Delete aliyun.helper.ts --- packages/server/src/helpers/aliyun.helper.ts | 26 -------------------- 1 file changed, 26 deletions(-) delete mode 100644 packages/server/src/helpers/aliyun.helper.ts diff --git a/packages/server/src/helpers/aliyun.helper.ts b/packages/server/src/helpers/aliyun.helper.ts deleted file mode 100644 index fd92fae2..00000000 --- a/packages/server/src/helpers/aliyun.helper.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ConfigService } from '@nestjs/config'; -import * as AliyunOSS from 'ali-oss'; - -export class AliyunOssClient { - configService: ConfigService; - - constructor(config) { - this.configService = config; - } - - private async buildClient() { - const config = this.configService.get('oss.aliyun'); - return new AliyunOSS(config); - } - - async putFile(filepath: string, buffer: ReadableStream) { - const client = await this.buildClient(); - const { url } = await client.put(filepath, buffer); - return url; - } - - async deleteFile(url: string) { - const client = await this.buildClient(); - await client.delete(url); - } -}