dwebp-bin

dwebp wrapper that makes it seamlessly available as a local dependency

Usage no npm install needed!

<script type="module">
  import dwebpBin from 'https://cdn.skypack.dev/dwebp-bin';
</script>

README

dwebp-bin GitHub Actions Status

WebP is a modern image format that provides superior lossless and lossy compression for images on the web. Using WebP, webmasters and web developers can create smaller, richer images that make the web faster.

Install

$ npm install dwebp-bin

WebP requires following libraries on Linux. See detail.

$ sudo apt-get install libjpeg-dev libpng-dev libtiff-dev libgif-dev

Usage

import {execFile} from 'node:child_process';
import dwebp from 'dwebp-bin';

execFile(dwebp, ['input.webp', '-o', 'output.png'], error => {
  if (error) {
    throw error;
  }

  console.log('Image is converted!');
});

CLI

$ npm install --global dwebp-bin
$ dwebp input.webp -o output.png

License

MIT © Shogo Sensui