mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 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:
committed by
GitHub
parent
d66d7dcd22
commit
f65dd44746
16
types/exif-reader/exif-reader-tests.ts
Normal file
16
types/exif-reader/exif-reader-tests.ts
Normal 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
22
types/exif-reader/index.d.ts
vendored
Normal 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;
|
||||
23
types/exif-reader/tsconfig.json
Normal file
23
types/exif-reader/tsconfig.json
Normal 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"
|
||||
]
|
||||
}
|
||||
1
types/exif-reader/tslint.json
Normal file
1
types/exif-reader/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "@definitelytyped/dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user