React image compression before upload
Call compress() inside your onChange handler — no React-specific wrapper required. An example App.jsx ships in the Compresso repository.
Comment ça marche
- npm install compresso.js
- On file input change, await compress(file, options)
- Set state with result.url or upload result.file
Questions courantes
- Next.js App Router?
- Yes — see the Next.js example in the repo.
Pour les développeurs
Intégrez la compression dans votre flux d’envoi :
npm install compresso.jsnpm · Docs