Files
knowai/types/upload/api.ts
tobegold574 382e3aff21 feat(reset): 以构造器模式重构
- 加了大文件传输自定义分片协议

BREAKING CHANGES: 0.1.0(latest)
2025-11-30 20:27:53 +08:00

78 lines
1.4 KiB
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 分片上传相关的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;
}