feat(reset): 以构造器模式重构

- 加了大文件传输自定义分片协议

BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
tobegold574
2025-11-30 20:27:53 +08:00
parent c5853847ae
commit 382e3aff21
82 changed files with 1421 additions and 7010 deletions

77
types/upload/api.ts Normal file
View File

@@ -0,0 +1,77 @@
// 分片上传相关的API接口定义
/**
* 文件分片请求接口
*/
export interface UploadChunkRequest {
/** 文件唯一标识 */
fileId: string;
/** 分片索引从0开始 */
chunkIndex: number;
/** 总分片数量 */
totalChunks: number;
/** 分片大小 */
chunkSize: number;
/** 文件总大小 */
totalSize: number;
/** 文件名称 */
fileName: string;
/** 文件类型 */
fileType: string;
}
/**
* 文件分片响应接口
*/
export interface UploadChunkResponse {
success: boolean;
message: string;
chunkIndex: number;
uploadedSize: number;
isLastChunk?: boolean;
}
/**
* 合并分片请求接口
*/
export interface MergeChunksRequest {
/** 文件唯一标识 */
fileId: string;
/** 总分片数量 */
totalChunks: number;
/** 文件名称 */
fileName: string;
/** 文件类型 */
fileType: string;
/** 文件总大小 */
totalSize: number;
}
/**
* 合并分片响应接口
*/
export interface MergeChunksResponse {
success: boolean;
message: string;
fileUrl?: string;
fileId: string;
fileSize: number;
}
/**
* 检查文件上传状态请求接口
*/
export interface CheckUploadStatusRequest {
/** 文件唯一标识 */
fileId: string;
}
/**
* 检查文件上传状态响应接口
*/
export interface CheckUploadStatusResponse {
success: boolean;
isUploaded: boolean;
uploadedChunks: number[];
totalChunks?: number;
}