ubdate
This commit is contained in:
32
node_modules/is-png/index.d.ts
generated
vendored
Normal file
32
node_modules/is-png/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
/// <reference types="node"/>
|
||||
|
||||
/**
|
||||
Check if a Buffer/Uint8Array is a [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) image.
|
||||
|
||||
@param buffer - The buffer to check. It only needs the first 8 bytes.
|
||||
@returns Whether `buffer` contains a PNG image.
|
||||
|
||||
@example
|
||||
```
|
||||
// Node.js:
|
||||
import readChunk = require('read-chunk');
|
||||
import isPng = require('is-png');
|
||||
|
||||
const buffer = readChunk.sync('unicorn.png', 0, 8);
|
||||
|
||||
isPng(buffer);
|
||||
//=> true
|
||||
|
||||
// Browser:
|
||||
(async () => {
|
||||
const response = await fetch('unicorn.png');
|
||||
const buffer = await response.arrayBuffer();
|
||||
|
||||
isPng(new Uint8Array(buffer));
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
*/
|
||||
declare function isPng(buffer: Uint8Array | Buffer): boolean;
|
||||
|
||||
export = isPng;
|
||||
18
node_modules/is-png/index.js
generated
vendored
Normal file
18
node_modules/is-png/index.js
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = buffer => {
|
||||
if (!buffer || buffer.length < 8) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
buffer[0] === 0x89 &&
|
||||
buffer[1] === 0x50 &&
|
||||
buffer[2] === 0x4E &&
|
||||
buffer[3] === 0x47 &&
|
||||
buffer[4] === 0x0D &&
|
||||
buffer[5] === 0x0A &&
|
||||
buffer[6] === 0x1A &&
|
||||
buffer[7] === 0x0A
|
||||
);
|
||||
};
|
||||
9
node_modules/is-png/license
generated
vendored
Normal file
9
node_modules/is-png/license
generated
vendored
Normal file
@@ -0,0 +1,9 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
78
node_modules/is-png/package.json
generated
vendored
Normal file
78
node_modules/is-png/package.json
generated
vendored
Normal file
@@ -0,0 +1,78 @@
|
||||
{
|
||||
"_from": "is-png@^2.0.0",
|
||||
"_id": "is-png@2.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-4KPGizaVGj2LK7xwJIz8o5B2ubu1D/vcQsgOGFEDlpcvgZHto4gBnyd0ig7Ws+67ixmwKoNmu0hYnpo6AaKb5g==",
|
||||
"_location": "/is-png",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "is-png@^2.0.0",
|
||||
"name": "is-png",
|
||||
"escapedName": "is-png",
|
||||
"rawSpec": "^2.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^2.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/imagemin-optipng"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/is-png/-/is-png-2.0.0.tgz",
|
||||
"_shasum": "ee8cbc9e9b050425cedeeb4a6fb74a649b0a4a8d",
|
||||
"_spec": "is-png@^2.0.0",
|
||||
"_where": "/var/www/html/jason/WeihnachtenMelly/node_modules/imagemin-optipng",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/sindresorhus/is-png/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Check if a Buffer/Uint8Array is a PNG image",
|
||||
"devDependencies": {
|
||||
"@types/node": "^11.13.5",
|
||||
"ava": "^1.4.1",
|
||||
"read-chunk": "^3.2.0",
|
||||
"tsd": "^0.7.2",
|
||||
"xo": "^0.24.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"homepage": "https://github.com/sindresorhus/is-png#readme",
|
||||
"keywords": [
|
||||
"png",
|
||||
"portable",
|
||||
"network",
|
||||
"graphics",
|
||||
"image",
|
||||
"picture",
|
||||
"photo",
|
||||
"type",
|
||||
"detect",
|
||||
"check",
|
||||
"is",
|
||||
"exif",
|
||||
"binary",
|
||||
"buffer",
|
||||
"uint8array"
|
||||
],
|
||||
"license": "MIT",
|
||||
"name": "is-png",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/sindresorhus/is-png.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
}
|
||||
57
node_modules/is-png/readme.md
generated
vendored
Normal file
57
node_modules/is-png/readme.md
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
# is-png [](https://travis-ci.org/sindresorhus/is-png)
|
||||
|
||||
> Check if a Buffer/Uint8Array is a [PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics) image
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install is-png
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
##### Node.js
|
||||
|
||||
```js
|
||||
const readChunk = require('read-chunk'); // npm install read-chunk
|
||||
const isPng = require('is-png');
|
||||
const buffer = readChunk.sync('unicorn.png', 0, 8);
|
||||
|
||||
isPng(buffer);
|
||||
//=> true
|
||||
```
|
||||
|
||||
##### Browser
|
||||
|
||||
```js
|
||||
(async () => {
|
||||
const response = await fetch('unicorn.png');
|
||||
const buffer = await response.arrayBuffer();
|
||||
|
||||
isPng(new Uint8Array(buffer));
|
||||
//=> true
|
||||
})();
|
||||
```
|
||||
|
||||
|
||||
## API
|
||||
|
||||
### isPng(buffer)
|
||||
|
||||
Accepts a Buffer (Node.js) or Uint8Array. Returns a `boolean` of whether `buffer` is a PNG image.
|
||||
|
||||
#### buffer
|
||||
|
||||
The buffer to check. It only needs the first 8 bytes.
|
||||
|
||||
|
||||
## Related
|
||||
|
||||
- [file-type](https://github.com/sindresorhus/file-type) - Detect the file type of a Buffer/Uint8Array/ArrayBuffer
|
||||
|
||||
|
||||
## License
|
||||
|
||||
MIT © [Sindre Sorhus](https://sindresorhus.com)
|
||||
Reference in New Issue
Block a user