-
Notifications
You must be signed in to change notification settings - Fork 49
/
custom.d.ts
113 lines (105 loc) · 3.1 KB
/
custom.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
declare module '*.scss';
declare module '*.svg' {
import React = require('react');
export const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
const src: string;
export default src;
}
declare module '*.png' {
const content: any;
export default content;
}
declare module '*.jpg' {
const content: any;
export default content;
}
declare module '*.gif' {
const content: any;
export default content;
}
declare module '*.ico' {
const content: any;
export default content;
}
declare module '*.wasm' {
const content: any;
export default content;
}
declare module '*?file' {
const content: string;
export default content;
}
// Web worker support
declare module 'worker-loader!*' {
class WebpackWorker extends Worker {
constructor();
}
export default WebpackWorker;
}
declare module 'node-exiftool' {
/**
* Custom type definition based on https://www.npmjs.com/package/node-exiftool
*/
namespace exiftool {
export interface IMetadata {
[key: string]: any;
SourceFile?: string;
HierarchicalSubject?: string | string[];
Subject?: string | string[];
Keywords?: string | string[];
ExifToolVersion?: number;
Orientation?: string;
XResolution?: number;
YResolution?: number;
ResolutionUnit?: string;
YCbCrPositioning?: string;
XMPToolkit?: string;
CreatorWorkURL?: string;
Scene?: string;
Creator?: string;
Author?: string;
ImageSize?: string;
Megapixels?: number;
}
class ExiftoolProcess {
constructor(exiftoolPath?: string);
open(options?: { detached?: boolean; env?: any }): Promise<number>;
close(): Promise<void>;
_open?: boolean;
/**
* Read metadata of one or more files.
*
* @param file The path to a file, or `'DIR'` for all files in a directory
* @param options Which attributes to return. Read everything with `['-File:all']`
* Or read specific attributes, e.g. `ep.readMetadata('photo.jpg', ['Creator', 'CreatorWorkURL', 'Orientation']`
* For charset problems, try reading with utf8 by passing in `'charset filename=utf8'`
*
*/
readMetadata(
file: string,
options?: string[],
): Promise<{ data: null | IMetadata[]; error: string | null }>;
/**
* You can write metadata with node-exiftool.
* Note: The returned "error" is also used as confirmation, e.g.
* `'1 image files updated'`
* @param file The path to a file
* @param data For example:
* ```ts
* const data = {
* all: '', // this removes all metadata at first
* comment: 'Exiftool rules!', // has to come after `all` in order not to be removed
* 'Keywords+': [ 'keywordA', 'keywordB' ],
* };
* ```
* @param args an array of any other arguments you wish to pass, e.g,. `['overwrite_original']`
*/
writeMetadata(
file: string,
data: IMetadata,
args?: string[],
): Promise<{ data: any | null; error: string | null }>;
}
}
export default exiftool;
}