Skip to content

compressImage

function compressImage(file, opts?): Promise<CompressResult>;

Defined in: packages/sdk/src/web/index.ts:249

Compress a single image. Browser-only; in Node/Bun this is a no-op that returns the input unchanged (with a warning).

Dynamically imports @aquienpz/asset-compressor-web so apps that never call compress: true don’t pay the compressorjs + heic2any bundle cost.

Parameter Type
file File | Blob
opts CompressOptions

Promise<CompressResult>