UNPKG

svelte-firebase-upload

Version:

Enterprise-grade file upload manager for Svelte with Firebase Storage integration, featuring concurrent uploads, resumable transfers, validation, health monitoring, and plugin system

37 lines (36 loc) 1.56 kB
import type { ResumableUploadState, ChunkState, ResumeOptions } from '../types.js'; export declare class UploadResumer { private _storageKey; private _chunkSize; private _verifyChunks; private _parallelChunks; constructor(options?: ResumeOptions); createResumableUpload(file: File, metadata?: Record<string, any>): Promise<ResumableUploadState>; resumeUpload(file: File, state: ResumableUploadState): Promise<{ state: ResumableUploadState; remainingChunks: ChunkState[]; progress: number; }>; uploadChunk(file: File, state: ResumableUploadState, chunk: ChunkState, uploadFunction: (chunk: Blob, metadata: any) => Promise<string>): Promise<{ success: boolean; url?: string; error?: string; }>; uploadChunksParallel(file: File, state: ResumableUploadState, chunks: ChunkState[], uploadFunction: (chunk: Blob, metadata: any) => Promise<string>): Promise<{ successful: number; failed: number; errors: string[]; }>; canResume(file: File): Promise<ResumableUploadState | null>; isUploadComplete(state: ResumableUploadState): boolean; getUploadProgress(state: ResumableUploadState): number; cleanupCompletedUploads(): Promise<void>; getAllUploadStates(): Promise<ResumableUploadState[]>; private createChunks; private calculateChunkHash; private generateFileId; private chunkArray; private saveUploadState; removeUploadState(fileId: string): Promise<void>; resumeIncompleteUploads(): Promise<void>; }