infinity-forge
Version:
25 lines (24 loc) • 651 B
TypeScript
export type BeforeDraw = (context: CanvasRenderingContext2D, canvas: HTMLCanvasElement) => void;
export interface CompressorOptions {
quality?: number;
maxWidth?: number;
maxHeight?: number;
mimeType?: string;
beforeDraw?: BeforeDraw;
success?: (result: Blob | File) => void;
error?: (error: Error) => void;
[key: string]: any;
}
export declare class Compressor {
private file;
private options;
private image;
private aborted;
private reader?;
constructor(file: File, options?: CompressorOptions);
private init;
private load;
private compress;
abort(): void;
private fail;
}