This commit is contained in:
chrosey
2017-09-13 07:52:34 +02:00
parent a1f16c37f4
commit 2340b0226b
24621 changed files with 2912161 additions and 149 deletions
+10
View File
@@ -0,0 +1,10 @@
'use strict';
module.exports = function (buf) {
if (!buf || buf.length < 3) {
return false;
}
return buf[0] === 71 &&
buf[1] === 73 &&
buf[2] === 70;
};
+105
View File
@@ -0,0 +1,105 @@
{
"_args": [
[
{
"raw": "is-gif@^1.0.0",
"scope": null,
"escapedName": "is-gif",
"name": "is-gif",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"c:\\xampp\\htdocs\\laravel\\node_modules\\imagemin-gifsicle"
]
],
"_from": "is-gif@>=1.0.0 <2.0.0",
"_id": "is-gif@1.0.0",
"_inCache": true,
"_location": "/is-gif",
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "1.4.21",
"_phantomChildren": {},
"_requested": {
"raw": "is-gif@^1.0.0",
"scope": null,
"escapedName": "is-gif",
"name": "is-gif",
"rawSpec": "^1.0.0",
"spec": ">=1.0.0 <2.0.0",
"type": "range"
},
"_requiredBy": [
"/imagemin-gifsicle"
],
"_resolved": "https://registry.npmjs.org/is-gif/-/is-gif-1.0.0.tgz",
"_shasum": "a6d2ae98893007bffa97a1d8c01d63205832097e",
"_shrinkwrap": null,
"_spec": "is-gif@^1.0.0",
"_where": "c:\\xampp\\htdocs\\laravel\\node_modules\\imagemin-gifsicle",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "http://sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/is-gif/issues"
},
"dependencies": {},
"description": "Check if a Buffer/Uint8Array is a GIF image",
"devDependencies": {
"mocha": "*",
"read-chunk": "^1.0.0"
},
"directories": {},
"dist": {
"shasum": "a6d2ae98893007bffa97a1d8c01d63205832097e",
"tarball": "https://registry.npmjs.org/is-gif/-/is-gif-1.0.0.tgz"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"gitHead": "5f7948d3e73d798490b6967a106c675e3843702c",
"homepage": "https://github.com/sindresorhus/is-gif",
"keywords": [
"gif",
"graphics",
"image",
"img",
"pic",
"picture",
"photo",
"type",
"detect",
"check",
"is",
"exif",
"binary",
"buffer",
"uint8array"
],
"license": "MIT",
"maintainers": [
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "is-gif",
"optionalDependencies": {},
"readme": "ERROR: No README data found!",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/is-gif.git"
},
"scripts": {
"test": "mocha"
},
"version": "1.0.0"
}
+55
View File
@@ -0,0 +1,55 @@
# is-gif [![Build Status](https://travis-ci.org/sindresorhus/is-gif.svg?branch=master)](https://travis-ci.org/sindresorhus/is-gif)
> Check if a Buffer/Uint8Array is a [GIF](http://en.wikipedia.org/wiki/Graphics_Interchange_Format) image
Used by [image-type](https://github.com/sindresorhus/image-type).
## Install
```sh
$ npm install --save is-gif
```
## Usage
##### Node.js
```js
var readChunk = require('read-chunk'); // npm install read-chunk
var isGif = require('is-gif');
var buffer = readChunk.sync('unicorn.gif', 0, 3);
isGif(buffer);
//=> true
```
##### Browser
```js
var xhr = new XMLHttpRequest();
xhr.open('GET', 'unicorn.gif');
xhr.responseType = 'arraybuffer';
xhr.onload = function () {
isGif(new Uint8Array(this.response));
//=> true
};
xhr.send();
```
## API
### isGif(buffer)
Accepts a Buffer (Node.js) or Uint8Array.
It only needs the first 3 bytes.
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)