🤖 Merge PR #62942 feat: add typings for exif-reader by @akwodkiewicz

* feat: add typings for exif-reader

* fix: correct tslint.json "extends"

* fix: remove dangling comma from tsconfig.json

* fix: remove patch version from header

* fix: declare export as CommonJS
This commit is contained in:
Andrzej Wódkiewicz
2022-10-28 22:57:39 +02:00
committed by GitHub
parent d66d7dcd22
commit f65dd44746
4 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,16 @@
import exifReader = require("exif-reader");
const buf = Buffer.from("some-exif-data");
const result = exifReader(buf);
console.log(result.exif);
console.log(result.gps);
console.log(result.image);
console.log(result.interoperability);
console.log(result.thumbnail);
// These records contain a variety of tags
console.log(result.gps?.GPSVersionID);
// But the list of valid tags is not provided in these typings
console.log(result.exif?.ThisTagDoesNotExist); // should pass

22
types/exif-reader/index.d.ts vendored Normal file
View File

@@ -0,0 +1,22 @@
// Type definitions for exif-reader 1.0
// Project: https://github.com/devongovett/exif-reader
// Definitions by: Andrzej Wódkiewicz <https://github.com/akwodkiewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/** Decode raw EXIF data from a `Buffer` */
declare function exifReader(buffer: Buffer): {
/** Basic TIFF properties about the image */
image?: Record<string, unknown>;
/** Basic TIFF properties about the embedded thumbnail */
thumbnail?: Record<string, unknown>;
/** Full EXIF data */
exif?: Record<string, unknown>;
/** GPS/location data about the image */
gps?: Record<string, unknown>;
/** Interoperability information */
interoperability?: Record<string, unknown>;
};
export = exifReader;

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",
"exif-reader-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "@definitelytyped/dtslint/dt.json" }