DefinitelyTyped/types/browser-image-compression/index.d.ts
Donald Chan 37cd32e962
add typings for browser-image-compression (#43165)
* add typings for browser-image-compression

* Update types/browser-image-compression/index.d.ts

Co-Authored-By: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>

* update test case

Co-authored-by: Piotr Błażejewicz (Peter Blazejewicz) <peterblazejewicz@users.noreply.github.com>
2020-03-26 22:36:01 -07:00

28 lines
972 B
TypeScript

// Type definitions for browser-image-compression 1.0
// Project: https://github.com/Donaldcwl/browser-image-compression
// Definitions by: Donald <https://github.com/Donaldcwl>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface Options {
/** @default Number.POSITIVE_INFINITY */
maxSizeMB?: number;
/** @default undefined */
maxWidthOrHeight?: number;
/** @default false */
useWebWorker?: boolean;
/** @default 10 */
maxIteration?: number;
/** Default to be the exif orientation from the image file */
exifOrientation?: number;
/** A function takes one progress argument (progress from 0 to 100) */
onProgress?: (progress: number) => void;
/** Default to be the original mime type from the image file */
fileType?: string;
}
declare function imageCompression(image: File | Blob, options: Options): Promise<File | Blob>;
export as namespace imageCompression;
export = imageCompression;