Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Node.js wrapper for cwebp binary
npm install cwebp
WebP library should be installed and its binaries should be in $PATH
.
var Webp = require('cwebp');
var webp = new Webp(source);
When source is a string node-webp
treats it as a file path.
var Webp = require('cwebp');
var webp = new Webp('image.jpeg');
It also accepts Buffers and Streams.
var webp = new Webp(buffer);
var webp = new Webp(stream);
webp.write('image.webp', function(err) {
console.log('converted');
});
webp.toBuffer(function(err, buffer) {
// ...
});
webp.stream(function(err, stream) {
// ...
});
Currently WebP library have no inner support for streaming, so it only works with files.
So, when Buffer or Stream is used node-webp
creates a temporary file to store its content.
To prevent leaks node-webp
creates temporary files only when .write()
, .stream()
or .toBuffer()
is called.
It removes all temporary files after conversion, but before triggering a callback.
So, converting Stream into a Buffer will cause two temporary files to be created and then removed.
It also means that node-webp
will start listening for new data in the source stream only when .write()
, .stream()
or .toBuffer()
is called.
node-webp
supports A+ promises.
webp.write('image.webp').then(function() {
// ...
});
webp.toBuffer().then(function(buffer) {
// ...
});
webp.stream().then(function(stream) {
// ...
});
node-webp
use when library.
node-webp
provides helper function for most of cwebp
conversion options. For the full list of available helpers see methods.json file.
webp.quality(60);
webp.command('-d', 'dump.pgm');
FAQs
node.js wrapper for cwebp and dwebp binaries from WebP image processing utility
The npm package cwebp receives a total of 2,187 weekly downloads. As such, cwebp popularity was classified as popular.
We found that cwebp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
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.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.