Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cwebp-bin

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cwebp-bin

cwebp node.js wrapper that convert JPG or PNG into WebP

  • 0.1.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
38K
decreased by-81.24%
Maintainers
1
Weekly downloads
 
Created

What is cwebp-bin?

The cwebp-bin npm package provides a Node.js wrapper for the cwebp command-line tool, which is used to convert images to the WebP format. This package allows developers to easily integrate WebP conversion into their Node.js applications.

What are cwebp-bin's main functionalities?

Convert JPEG to WebP

This feature allows you to convert a JPEG image to WebP format using the cwebp command-line tool. The code sample demonstrates how to use the execFile function from the child_process module to execute the cwebp command with the input and output file paths.

const cwebp = require('cwebp-bin');
const { execFile } = require('child_process');

execFile(cwebp, ['input.jpg', '-o', 'output.webp'], err => {
  if (err) {
    throw err;
  }
  console.log('Image converted to WebP format');
});

Convert PNG to WebP

This feature allows you to convert a PNG image to WebP format using the cwebp command-line tool. The code sample demonstrates how to use the execFile function from the child_process module to execute the cwebp command with the input and output file paths.

const cwebp = require('cwebp-bin');
const { execFile } = require('child_process');

execFile(cwebp, ['input.png', '-o', 'output.webp'], err => {
  if (err) {
    throw err;
  }
  console.log('Image converted to WebP format');
});

Set WebP Quality

This feature allows you to set the quality of the output WebP image. The code sample demonstrates how to use the '-q' option with the cwebp command to specify the quality level (in this case, 80) for the output WebP image.

const cwebp = require('cwebp-bin');
const { execFile } = require('child_process');

execFile(cwebp, ['input.jpg', '-q', '80', '-o', 'output.webp'], err => {
  if (err) {
    throw err;
  }
  console.log('Image converted to WebP format with quality 80');
});

Other packages similar to cwebp-bin

FAQs

Package last updated on 05 Jun 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc