Added typings for is-png.

This commit is contained in:
jameswilddev
2018-12-09 18:32:50 +00:00
parent b05787db37
commit ac91e21e25
4 changed files with 47 additions and 0 deletions
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for is-png 1.1
// Project: https://github.com/sindresorhus/is-png#readme
// Definitions by: James Wild <https://github.com/jameswilddev>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* Check whether a buffer contains a PNG image.
* @remarks This only performs a header check, and the buffer may not parse as a PNG file.
* @param buffer The buffer to check.
* @returns Whether the given buffer contains a PNG image.
*/
declare function isPng(buffer: Uint8Array | Buffer): boolean;
export = isPng;
+7
View File
@@ -0,0 +1,7 @@
import isPng = require("is-png");
const uint8Array = new Uint8Array(0);
isPng(uint8Array); // $ExpectType boolean
const buffer = Buffer.from(uint8Array);
isPng(buffer); // $ExpectType boolean
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"is-png-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }