mirror of
https://github.com/outline/outline.git
synced 2026-11-23 06:11:04 +03:00
* Add missing JSDoc to exported members in app and server utils Documents all exported functions, classes, enums, and constants in app/utils and server/utils that were missing JSDoc, per the project documentation guidelines. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU * Use @returns tag to match codebase convention Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AsEQYA8zN813thxu7GjjzU --------- Co-authored-by: Claude <noreply@anthropic.com>
22 lines
586 B
TypeScript
22 lines
586 B
TypeScript
import Compressor from "compressorjs";
|
|
|
|
type Options = {
|
|
maxWidth?: number;
|
|
maxHeight?: number;
|
|
};
|
|
|
|
/**
|
|
* Compresses an image file or blob, optionally constraining its dimensions.
|
|
*
|
|
* @param file the image file or blob to compress.
|
|
* @param options optional maximum width and height constraints.
|
|
* @returns a promise resolving to the compressed image blob.
|
|
*/
|
|
export const compressImage = async (
|
|
file: File | Blob,
|
|
options?: Options
|
|
): Promise<Blob> =>
|
|
new Promise((resolve, reject) => {
|
|
new Compressor(file, { ...options, success: resolve, error: reject });
|
|
});
|