perf: 优化文件下载包名

This commit is contained in:
xiaojunnuo
2024-05-30 10:12:48 +08:00
parent 39ad7597fa
commit d9eb927b0a
17 changed files with 48 additions and 30 deletions
+4 -10
View File
@@ -21,16 +21,10 @@
"mig": "typeorm migration:create -n name"
},
"dependencies": {
"@certd/acme-client": "^1.20.9",
"@certd/pipeline": "^1.20.9",
"@certd/plugin-aliyun": "^1.20.9",
"@certd/plugin-all": "^1.20.9",
"@certd/plugin-center": "^1.20.9",
"@certd/plugin-cert": "^1.20.9",
"@certd/plugin-host": "^1.20.9",
"@certd/plugin-huawei": "^1.20.9",
"@certd/plugin-tencent": "^1.20.9",
"@certd/plugin-util": "^1.20.9",
"@certd/acme-client": "workspace:^1.20.9",
"@certd/pipeline": "workspace:^1.20.9",
"@certd/plugin-cert": "workspace:^1.20.9",
"@certd/plugin-util": "workspace:^1.20.9",
"@alicloud/cs20151215": "^3.0.3",
"@alicloud/openapi-client": "^0.4.0",
"@alicloud/pop-core": "^1.7.10",
@@ -32,6 +32,7 @@ export abstract class CrudController<T> extends BaseController {
@Body(ALL)
bean
) {
delete bean.id;
const id = await this.getService().add(bean);
return this.ok(id);
}
@@ -19,6 +19,7 @@ import { PipelineService } from '../service/pipeline-service';
import { CommonException } from '../../../basic/exception/common-exception';
import { PermissionException } from '../../../basic/exception/permission-exception';
import * as fs from 'fs';
import { logger } from '../../../utils/logger';
/**
* 证书
@@ -151,7 +152,7 @@ export class HistoryController extends CrudController<HistoryService> {
// const filename = file.filename;
// 要下载的文件的完整路径
const path = file.path;
logger.info(`download:${path}`);
// 以流的形式下载文件
this.ctx.attachment(path);
this.ctx.set('Content-Type', 'application/octet-stream');