Skip to content
scroll to zoom · drag to pan

compressImage

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

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

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

Dynamically imports @nitida/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>