1
0
mirror of https://github.com/outline/outline.git synced 2025-03-15 19:18:00 +00:00

15 lines
320 B
TypeScript
Raw Permalink Normal View History

import Compressor from "compressorjs";
type Options = {
maxWidth?: number;
maxHeight?: number;
};
export const compressImage = async (
file: File | Blob,
options?: Options
): Promise<Blob> =>
new Promise((resolve, reject) => {
new Compressor(file, { ...options, success: resolve, error: reject });
});