is-cwebp-readable
Check if a Buffer/Uint8Array is available for cwebp image source
var fs = require('fs');
var isCwebpReadable = require('is-cwebp-readable');
isCwebpReadable(fs.readFileSync('fixture.png'));
isCwebpReadable(fs.readFileSync('fixture.bmp'));
Installation
Use npm.
npm install is-cwebp-readable
API
var 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
.
License
Copyright (c) Shinnosuke Watanabe
Licensed under the MIT License.