feat(reset): 以构造器模式重构
- 加了大文件传输自定义分片协议 BREAKING CHANGES: 0.1.0(latest)
This commit is contained in:
77
types/upload/api.ts
Normal file
77
types/upload/api.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user