first commit
This commit is contained in:
10
build/node_modules/is-jpg/index.js
generated
vendored
Normal file
10
build/node_modules/is-jpg/index.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
'use strict';
|
||||
module.exports = function (buf) {
|
||||
if (!buf || buf.length < 3) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return buf[0] === 255 &&
|
||||
buf[1] === 216 &&
|
||||
buf[2] === 255;
|
||||
};
|
||||
82
build/node_modules/is-jpg/package.json
generated
vendored
Normal file
82
build/node_modules/is-jpg/package.json
generated
vendored
Normal file
@@ -0,0 +1,82 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"is-jpg@1.0.0",
|
||||
"/Users/asciidisco/Desktop/asciidisco.com/build"
|
||||
]
|
||||
],
|
||||
"_from": "is-jpg@1.0.0",
|
||||
"_id": "is-jpg@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-KVnBfnNDDbOCZNp1uQ3VTy2G2hw=",
|
||||
"_location": "/is-jpg",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "is-jpg@1.0.0",
|
||||
"name": "is-jpg",
|
||||
"escapedName": "is-jpg",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/imagemin-jpeg-recompress",
|
||||
"/imagemin-jpegoptim",
|
||||
"/imagemin-jpegtran",
|
||||
"/imagemin-mozjpeg"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-jpg/-/is-jpg-1.0.0.tgz",
|
||||
"_spec": "1.0.0",
|
||||
"_where": "/Users/asciidisco/Desktop/asciidisco.com/build",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "http://sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-jpg/issues"
|
||||
},
|
||||
"description": "Check if a Buffer/Uint8Array is a JPEG image",
|
||||
"devDependencies": {
|
||||
"mocha": "*",
|
||||
"read-chunk": "^1.0.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/is-jpg#readme",
|
||||
"keywords": [
|
||||
"jpg",
|
||||
"jpeg",
|
||||
"image",
|
||||
"img",
|
||||
"pic",
|
||||
"picture",
|
||||
"photo",
|
||||
"type",
|
||||
"detect",
|
||||
"check",
|
||||
"is",
|
||||
"exif",
|
||||
"binary",
|
||||
"buffer",
|
||||
"uint8array",
|
||||
"cli",
|
||||
"bin"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-jpg",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/is-jpg.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
55
build/node_modules/is-jpg/readme.md
generated
vendored
Normal file
55
build/node_modules/is-jpg/readme.md
generated
vendored
Normal file
@@ -0,0 +1,55 @@
|
||||
# is-jpg [](https://travis-ci.org/sindresorhus/is-jpg)
|
||||
|
||||
> Check if a Buffer/Uint8Array is a [JPEG](http://en.wikipedia.org/wiki/JPEG) image
|
||||
|
||||
Used by [image-type](https://github.com/sindresorhus/image-type).
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```sh
|
||||
$ npm install --save is-jpg
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
##### Node.js
|
||||
|
||||
```js
|
||||
var readChunk = require('read-chunk'); // npm install read-chunk
|
||||
var isJpg = require('is-jpg');
|
||||
var buffer = readChunk.sync('unicorn.jpg', 0, 3);
|
||||
|
||||
isJpg(buffer);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### Browser
|
||||
|
||||
```js
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'unicorn.jpg');
|
||||
xhr.responseType = 'arraybuffer';
|
||||
|
||||
xhr.onload = function () {
|
||||
isJpg(new Uint8Array(this.response));
|
||||
//=> true
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isJpg(buffer)
|
||||
|
||||
Accepts a Buffer (Node.js) or Uint8Array.
|
||||
|
||||
It only needs the first 3 bytes.
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](http://sindresorhus.com)
|
||||
Reference in New Issue
Block a user