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; | ||
} |
{ | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
0
Yes
2633
8
38
- Removedfile-type@^10.4.0
- Removedfile-type@10.11.0(transitive)