import { Uploader } from './index'; import { UploaderChunk } from './UploaderChunk'; import { RequestError } from '../request'; import { ChunkSchema } from './types'; import { ResolveInputType } from '../chunker/types'; type NotExistsErrorType = 'IV' | 'SESSION_ID' | 'DB_ID' | 'ENCRYPTED_SIZE' | 'UPLOAD_PROCESS'; /** * This class is the most impoertant class in the Upload section. * All the user needs are in this class. * @example * * ```tsx * import { Uploader } from 'fast-sdk' * const uploader = new Uploader({ * threads: 5, * retry: 1, * }) * ``` * * ```tsx * const uploaderItem = new UploaderItem(uploader, file, "ENCRYPTION KEY") * uploaderItem.iv = "IV" * // This is the IV (Initialization vector) for AES encryption * let sessionId = "" * if(uploaderItem.encryptedSize) * sessionId = await uploaderItem.getSessionId(uploaderItem.encryptedSize) * uploaderItem.session_id = sessionId; * await uploaderItem.chunkFile() * // This method will chunk the file into pieces (based on the bucket-list algorithm with [100, 50, 25, 10, 3, 1] -in MegaBytes- as buckets) and stores them into the uploaderItem.chunks * await uploaderItem.upload() * ``` */ export declare class UploaderItem { uploader: Uploader; file: File; encryptionKey: string; parallelTasksAmount: number; updateProgressFunc?(progress: number): void; setIsAssembled?(assembled: boolean): void; name: string; type: string; size: number; chunks: UploaderChunk[]; chunkIndex: number; isUploading: boolean; isAssembling: boolean; chunkSchema: ChunkSchema; progress: number; uploaded: number; encryptedSize?: number; dbId: number | null; iv?: string; session_id?: string; sessionIdPromise?: Promise; error?: RequestError | null; uploadStartTime?: number; speed: number; constructor(uploader: Uploader, file: File, encryptionKey: string); init(): Promise; set(key: keyof UploaderItem, value: unknown): void; calculateSpeed(): number; updateProgress(): void; createUploaderChunks(_chunks: ResolveInputType): Promise<{ chunks: UploaderChunk[]; chunkSchema: { size: number; remainder: number; number: number; }; } | undefined>; chunkFile(): Promise; syncWithIndexedDB(): Promise; deleteFromIndexedDB(): Promise; upload(): Promise; abort(): void; chunkUploaded(): Promise; getSessionId(): Promise | undefined; assemble(): Promise; uploadError(error: RequestError): void; setError(error: Error): void; _setError(type: NotExistsErrorType): void; } export {};