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

is-cwebp-readable

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-cwebp-readable - npm Package Compare versions

Comparing version 2.0.1 to 3.0.0-0

12

index.js

@@ -6,11 +6,11 @@ 'use strict';

module.exports = function isCwebpReadable(buf) {
const type = fileType(buf);
const type = fileType(buf);
if (!type) {
return false;
}
if (!type) {
return false;
}
const ext = type.ext;
const ext = type.ext;
return ext === 'png' || ext === 'jpg' || ext === 'tif' || ext === 'webp';
return ext === 'png' || ext === 'jpg' || ext === 'tif' || ext === 'webp';
};
{
"name": "is-cwebp-readable",
"version": "2.0.1",
"description": "Check if a Buffer/Uint8Array is available for cwebp image source",
"repository": "shinnn/is-cwebp-readable",
"author": "Shinnosuke Watanabe (https://github.com/shinnn)",
"scripts": {
"bench": "node -p \"require('chalk').yellow('NOTE: Smaller is better.\\n')\" && node benchmark/array-index-of.js && node benchmark/array-includes.js && node benchmark/keys.js && node benchmark/logical-or.js && node benchmark/regexp-test.js && node benchmark/set.js && node -p \"''\"",
"pretest": "eslint --fix --format=codeframe benchmark index.js test.js",
"test": "node --throw-deprecation --track-heap-objects test.js | tap-spec",
"coverage": "istanbul cover test.js"
},
"license": "CC0-1.0",
"files": [
"index.js"
],
"keywords": [
"buffer",
"uint8array",
"type",
"file",
"detect",
"image",
"jpg",
"jpeg",
"png",
"tif",
"tiff",
"webp",
"cwebp"
],
"dependencies": {
"file-type": "^4.3.0"
},
"devDependencies": {
"@shinnn/eslint-config-node": "^3.0.0",
"eslint": "^3.19.0",
"istanbul": "^0.4.5",
"tap-spec": "^4.1.1",
"tape": "^4.6.3"
},
"eslintConfig": {
"extends": "@shinnn/node"
}
"name": "is-cwebp-readable",
"version": "3.0.0-0",
"description": "Check if a Buffer/Uint8Array is available for cwebp image source",
"repository": "shinnn/is-cwebp-readable",
"author": "Shinnosuke Watanabe (https://github.com/shinnn)",
"license": "CC0-1.0",
"scripts": {
"bench": "node -p \"require('chalk').yellow('NOTE: Smaller is better.\\n')\" && node benchmark/array-index-of.js && node benchmark/array-includes.js && node benchmark/keys.js && node benchmark/logical-or.js && node benchmark/regexp-test.js && node benchmark/set.js && node -p \"''\"",
"pretest": "eslint .",
"test": "nyc node test.js"
},
"files": [
"index.js"
],
"keywords": [
"buffer",
"uint8array",
"type",
"file",
"detect",
"image",
"jpg",
"jpeg",
"png",
"tif",
"tiff",
"webp",
"cwebp"
],
"dependencies": {
"file-type": "^10.5.0"
},
"devDependencies": {
"@shinnn/eslint-config": "^6.8.1",
"chalk": "^2.4.1",
"eslint": "^5.9.0",
"nyc": "^13.1.0",
"nyc-config-common": "^1.0.1",
"tape": "^4.9.1"
},
"eslintConfig": {
"extends": "@shinnn"
},
"nyc": {
"extends": "nyc-config-common"
}
}

@@ -5,6 +5,3 @@ # is-cwebp-readable

[![Build Status](https://travis-ci.org/shinnn/is-cwebp-readable.svg?branch=master)](https://travis-ci.org/shinnn/is-cwebp-readable)
[![Build status](https://ci.appveyor.com/api/projects/status/lrfe3hgtupsg45l1?svg=true)](https://ci.appveyor.com/project/ShinnosukeWatanabe/is-cwebp-readable)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/is-cwebp-readable.svg)](https://coveralls.io/github/shinnn/is-cwebp-readable)
[![Dependency Status](https://david-dm.org/shinnn/is-cwebp-readable.svg)](https://david-dm.org/shinnn/is-cwebp-readable)
[![devDependency Status](https://david-dm.org/shinnn/is-cwebp-readable/dev-status.svg)](https://david-dm.org/shinnn/is-cwebp-readable#info=devDependencies)

@@ -14,7 +11,7 @@ Check if a Buffer/Uint8Array is available for [cwebp](https://developers.google.com/speed/webp/docs/cwebp) image source

```javascript
const fs = require('fs');
const {readFileSync} = require('fs');
const isCwebpReadable = require('is-cwebp-readable');
isCwebpReadable(fs.readFileSync('fixture.png')); //=> true
isCwebpReadable(fs.readFileSync('fixture.bmp')); //=> false
isCwebpReadable(readFileSync('fixture.png')); //=> true
isCwebpReadable(readFileSync('fixture.bmp')); //=> false
```

@@ -26,3 +23,3 @@

```sh
```
npm install is-cwebp-readable

@@ -37,6 +34,6 @@ ```

### isCwebpReadable(*buf*)
### isCwebpReadable(*data*)
*buf*: [`Buffer`](https://nodejs.org/api/buffer.html#buffer_class_buffer) or [`Uint8Array`](https://www.khronos.org/registry/typedarray/specs/latest/#TYPEDARRAYS)
Return: `Boolean`
*data*: [`Buffer`](https://nodejs.org/api/buffer.html#buffer_class_buffer) or [`Uint8Array`](http://www.ecma-international.org/ecma-262/6.0/#sec-typedarray-objects)
Return: `boolean`

@@ -43,0 +40,0 @@ It returns `true` if the data is [PNG](https://wikipedia.org/wiki/Portable_Network_Graphics), [JPEG](https://wikipedia.org/wiki/JPEG), [TIFF](https://wikipedia.org/wiki/Tagged_Image_File_Format), or [WebP](https://wikipedia.org/wiki/WebP), otherwise `false`.

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