import Base, {Extra} from './base'; export interface AwsMultiPart { ETag: string | undefined; PartNumber: number; } export interface UploadedChunkStorage { ETag: string | undefined; PartNumber: number; MD5: undefined | string; } export interface ChunkLoaded { mkFileProgress: 0 | 1; chunks: number[]; } export interface ChunkInfo { chunk: Blob; index: number; } export interface LocalInfo { data: UploadedChunkStorage[]; id: string | undefined; } export interface ChunkPart { ETag: string | undefined; PartNumber: number; } export interface UploadChunkBody extends Extra { Parts: ChunkPart[]; } export default class Resume extends Base { /** * @description 文件的分片 chunks */ private chunks; /** * @description 使用缓存的 chunks */ private usedCacheList; /** * @description 来自缓存的上传信息 */ private cachedUploadedList; /** * @description 当前上传过程中已完成的上传信息 */ private uploadedList; /** * CompleteMultipartUploadCommand中的Parts参数 * @private */ private parts; /** * @description 当前上传片进度信息 */ private loaded; /** * @description 当前上传任务的 id */ private uploadId; /** * fixme * AWS Bucket Owner Account ID * @private */ private expectedBucketOwner; /** * @returns * @description 实现了 Base 的 run 接口,处理具体的分片上传事务,并抛出过程中的异常。 */ protected run(): Promise; private uploadChunk; private mkFileReq; private initBeforeUploadChunks; private getUploadInfo; private getLocalKey; private updateLocalCache; private updateChunkProgress; private updateMkFileProgress; private notifyResumeProgress; }