import ResumableChunk from './resumableChunk'; import ResumableEventHandler from './resumableEventHandler'; import { UploadTaskId } from './types/types'; /** * A single file object that should be uploaded in multiple chunks */ export default class ResumableFile extends ResumableEventHandler { private opts; private _prevProgress; private isPaused; private _file; private _fileName; private _size; private _relativePath; private _uniqueIdentifier; /** The offset of that file in the files array of the corresponding file category. */ private _offset; private _fileCategory; private _error; private _chunks; private chunkSize; private simultaneousUploads; private debugVerbosityLevel; constructor(file: File, uniqueIdentifier: string, fileCategory: string, offset: number, options: object); /** * Set the options provided inside the configuration object on this instance */ private setInstanceProperties; get file(): File; get fileName(): string; get size(): number; get relativePath(): string; get uniqueIdentifier(): string; get offset(): number; get fileCategory(): string; get chunks(): ResumableChunk[]; /** * Stop current uploads for this file */ abort(): void; /** * Cancel uploading this file and remove it from the file list */ cancel(): void; /** * Retry uploading this file */ retry(): void; /** * Prepare this file for a new upload, by dividing it into multiple chunks */ private bootstrap; /** * Get the progress for uploading this file based on the progress of the individual file chunks */ progress(): number; resetError(): void; /** * Check whether at least one of this file's chunks is currently uploading */ get isUploading(): boolean; /** * Check whether all of this file's chunks completed their upload requests and whether it should be * treated as completed. */ get isComplete(): boolean; get hasError(): boolean; /** * Initiate the upload of the chunk with the given index. Returns whether a new upload was started or not. */ uploadChunk(chunkIndex: number, uploadTaskId: UploadTaskId, isFinalCheck: boolean): boolean; /** * Mark a given number of chunks as already uploaded to the server. * @param chunkNumber The index until which all chunks should be marked as completed */ markChunksCompleted(chunkNumber: number): void; }