Update local.client.ts

This commit is contained in:
fantasticit 2022-06-04 19:49:34 +08:00
parent ed03f1e90f
commit 77435213ec
1 changed files with 4 additions and 4 deletions

View File

@ -24,7 +24,7 @@ export class LocalOssClient extends BaseOssClient {
* @param md5
* @returns
*/
protected storeFilePath(md5: string): {
protected getStoreDir(md5: string): {
relative: string;
absolute: string;
} {
@ -57,7 +57,7 @@ export class LocalOssClient extends BaseOssClient {
*/
async uploadFile(file: Express.Multer.File, query: FileQuery): Promise<string> {
const { filename, md5 } = query;
const { absolute, relative } = this.storeFilePath(md5);
const { absolute, relative } = this.getStoreDir(md5);
const absoluteFilepath = path.join(absolute, filename);
const relativeFilePath = path.join(relative, filename);
@ -80,7 +80,7 @@ export class LocalOssClient extends BaseOssClient {
throw new Error('请指定 chunkIndex');
}
const { absolute, relative } = this.storeFilePath(md5);
const { absolute, relative } = this.getStoreDir(md5);
const absoluteFilepath = path.join(absolute, filename);
if (fs.existsSync(absoluteFilepath)) {
@ -100,7 +100,7 @@ export class LocalOssClient extends BaseOssClient {
*/
async mergeChunk(query: FileQuery): Promise<string> {
const { filename, md5 } = query;
const { absolute, relative } = this.storeFilePath(md5);
const { absolute, relative } = this.getStoreDir(md5);
const absoluteFilepath = path.join(absolute, filename);
const relativeFilePath = path.join(relative, filename);