Socket
Socket
Sign inDemoInstall

is-gif

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

is-gif - npm Package Compare versions

Comparing version 3.0.0 to 4.0.0

15

index.js

@@ -1,12 +0,9 @@

'use strict';
const fileType = require('file-type');
module.exports = input => {
const match = fileType(input);
if (!match) {
export default function isGif(buffer) {
if (!buffer || buffer.length < 3) {
return false;
}
return match.ext === 'gif';
};
return buffer[0] === 0x47
&& buffer[1] === 0x49
&& buffer[2] === 0x46;
}

18

package.json
{
"name": "is-gif",
"version": "3.0.0",
"version": "4.0.0",
"description": "Check if a Buffer/Uint8Array is a GIF image",
"license": "MIT",
"repository": "sindresorhus/is-gif",
"funding": "https://github.com/sponsors/sindresorhus",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"type": "module",
"exports": "./index.js",
"engines": {
"node": ">=6"
"node": "^12.20.0 || ^14.13.1 || >=16.0.0"
},

@@ -25,4 +28,2 @@ "scripts": {

"image",
"img",
"pic",
"picture",

@@ -39,9 +40,6 @@ "photo",

],
"dependencies": {
"file-type": "^10.4.0"
},
"devDependencies": {
"ava": "^0.25.0",
"xo": "^0.23.0"
"ava": "^3.15.0",
"xo": "^0.44.0"
}
}

@@ -1,6 +0,5 @@

# is-gif [![Build Status](https://travis-ci.com/sindresorhus/is-gif.svg?branch=master)](https://travis-ci.com/sindresorhus/is-gif)
# is-gif
> Check if a Buffer/Uint8Array is a [GIF](https://en.wikipedia.org/wiki/Graphics_Interchange_Format) image
## Install

@@ -12,10 +11,9 @@

## Usage
```js
const readChunk = require('read-chunk');
const isGif = require('is-gif');
import {readChunk} from 'read-chunk';
import isGif from 'is-gif';
const buffer = readChunk.sync('unicorn.gif', 0, 3);
const buffer = await readChunk('unicorn.gif', 0, 3);

@@ -26,3 +24,2 @@ isGif(buffer);

## API

@@ -32,16 +29,12 @@

Returns a boolean of whether `input` is a GIF image.
#### input
Type: `Buffer` `Uint8Array`
Type: `Buffer | Uint8Array`
It only needs the first 3 bytes.
## Related
- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array
## License
MIT © [Sindre Sorhus](https://sindresorhus.com)

Sorry, the diff of this file is not supported yet

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