…
|
||
---|---|---|
.. | ||
node_modules/file-type | ||
index.js | ||
package.json | ||
README.md |
is-cwebp-readable
Check if a Buffer/Uint8Array is available for cwebp image source
const fs = require('fs');
const isCwebpReadable = require('is-cwebp-readable');
isCwebpReadable(fs.readFileSync('fixture.png')); //=> true
isCwebpReadable(fs.readFileSync('fixture.bmp')); //=> false
Installation
npm install is-cwebp-readable
API
const isCwebpReadable = require('is-cwebp-readable');
isCwebpReadable(buf)
buf: Buffer
or Uint8Array
Return: Boolean
It returns true
if the data is PNG, JPEG, TIFF, or WebP, otherwise false
.