import { VoidUploadResult } from "./index"; import { AuthHandler } from "./api"; /** * Generic upload state */ export declare enum UploadState { NotStarted = 0, Starting = 1, Hashing = 2, Uploading = 3, Done = 4, Failed = 5, Challenge = 6 } export type StateChangeHandler = (s: UploadState) => void; export type ProgressHandler = (loaded: number) => void; export type ProxyChallengeHandler = (html: string) => void; /** * Base file uploader class */ export declare abstract class VoidUploader { protected uri: string; protected file: File | Blob; protected auth?: AuthHandler; protected maxChunkSize: number; protected onStateChange?: StateChangeHandler; protected onProgress?: ProgressHandler; protected onProxyChallenge?: ProxyChallengeHandler; constructor(uri: string, file: File | Blob, stateChange?: StateChangeHandler, progress?: ProgressHandler, proxyChallenge?: ProxyChallengeHandler, auth?: AuthHandler, chunkSize?: number); /** * SHA-256 hash the entire blob * @param file * @protected */ protected digest(file: Blob): Promise; /** * Upload a file to the API * @param headers any additional headers to send with the request */ abstract upload(headers?: HeadersInit): Promise; /** * Can we use local encryption */ abstract canEncrypt(): boolean; /** * Enable/Disable encryption, file will be encrypted on the fly locally before uploading */ abstract setEncryption(s: boolean): void; /** * Get the encryption key, should be called after enableEncryption() */ abstract getEncryptionKey(): string | undefined; } //# sourceMappingURL=upload.d.ts.map