Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Check if a Buffer/Uint8Array is a WebP image
Used by image-type.
$ npm install --save is-webp
$ bower install --save is-webp
$ component install sindresorhus/is-webp
var readChunk = require('read-chunk'); // npm install read-chunk
var isWebp = require('is-webp');
var buffer = readChunk.sync('unicorn.webp', 0, 12);
isWebp(buffer);
//=> true
var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.webp');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isWebp(new Uint8Array(this.response));
//=> true
};
xhr.send();
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 12 bytes.
MIT © Sindre Sorhus
FAQs
Check if a Buffer/Uint8Array is a WebP image
The npm package is-webp receives a total of 661 weekly downloads. As such, is-webp popularity was classified as not popular.
We found that is-webp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.