mirror of https://github.com/fantasticit/think.git
Update local.client.ts
This commit is contained in:
parent
ed03f1e90f
commit
77435213ec
|
@ -24,7 +24,7 @@ export class LocalOssClient extends BaseOssClient {
|
||||||
* @param md5
|
* @param md5
|
||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
protected storeFilePath(md5: string): {
|
protected getStoreDir(md5: string): {
|
||||||
relative: string;
|
relative: string;
|
||||||
absolute: string;
|
absolute: string;
|
||||||
} {
|
} {
|
||||||
|
@ -57,7 +57,7 @@ export class LocalOssClient extends BaseOssClient {
|
||||||
*/
|
*/
|
||||||
async uploadFile(file: Express.Multer.File, query: FileQuery): Promise<string> {
|
async uploadFile(file: Express.Multer.File, query: FileQuery): Promise<string> {
|
||||||
const { filename, md5 } = query;
|
const { filename, md5 } = query;
|
||||||
const { absolute, relative } = this.storeFilePath(md5);
|
const { absolute, relative } = this.getStoreDir(md5);
|
||||||
const absoluteFilepath = path.join(absolute, filename);
|
const absoluteFilepath = path.join(absolute, filename);
|
||||||
const relativeFilePath = path.join(relative, filename);
|
const relativeFilePath = path.join(relative, filename);
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ export class LocalOssClient extends BaseOssClient {
|
||||||
throw new Error('请指定 chunkIndex');
|
throw new Error('请指定 chunkIndex');
|
||||||
}
|
}
|
||||||
|
|
||||||
const { absolute, relative } = this.storeFilePath(md5);
|
const { absolute, relative } = this.getStoreDir(md5);
|
||||||
const absoluteFilepath = path.join(absolute, filename);
|
const absoluteFilepath = path.join(absolute, filename);
|
||||||
|
|
||||||
if (fs.existsSync(absoluteFilepath)) {
|
if (fs.existsSync(absoluteFilepath)) {
|
||||||
|
@ -100,7 +100,7 @@ export class LocalOssClient extends BaseOssClient {
|
||||||
*/
|
*/
|
||||||
async mergeChunk(query: FileQuery): Promise<string> {
|
async mergeChunk(query: FileQuery): Promise<string> {
|
||||||
const { filename, md5 } = query;
|
const { filename, md5 } = query;
|
||||||
const { absolute, relative } = this.storeFilePath(md5);
|
const { absolute, relative } = this.getStoreDir(md5);
|
||||||
const absoluteFilepath = path.join(absolute, filename);
|
const absoluteFilepath = path.join(absolute, filename);
|
||||||
const relativeFilePath = path.join(relative, filename);
|
const relativeFilePath = path.join(relative, filename);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue