WebP decoding for Node.js, using [libwebp][libwebp] compiled to [WebAssembly][WebAssembly].
npm install @cwasm/webpWebP decoding for Node.js, using [libwebp][libwebp] compiled to [WebAssembly][WebAssembly].
[libwebp]: https://developers.google.com/speed/webp/docs/api
[WebAssembly]: https://webassembly.org
``sh`
npm install --save @cwasm/webp
`js
const fs = require('fs')
const webp = require('@cwasm/webp')
const source = fs.readFileSync('image.webp')
const image = webp.decode(source)
console.log(image)
// { width: 128,
// height: 128,
// data:
// Uint8ClampedArray [ ... ] }
`
- source (Uint8Array, required) - The WEBP dataImageData` - Decoded width, height and pixel data
- returns