-
-
Notifications
You must be signed in to change notification settings - Fork 18
/
index.d.ts
127 lines (111 loc) · 2.93 KB
/
index.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
import {
ResizeOptions,
RGBA,
Region,
ExtendOptions,
ThresholdOptions,
AvailableFormatInfo,
OutputOptions,
JpegOptions,
PngOptions,
Kernel,
OverlayOptions,
FlattenOptions,
WriteableMetadata,
Raw,
Matrix3x3,
Color
} from 'sharp';
import { UploadOptions } from '@google-cloud/storage';
export declare interface Size {
width?: number;
height?: number;
option?: ResizeOptions;
}
export declare interface Sharpen {
sigma?: number;
flat?: number;
jagged?: number;
}
export declare interface Threshold {
threshold?: number;
options?: ThresholdOptions;
}
export declare interface Modulate {
brightness?: number;
saturation?: number;
hue?: number;
}
export declare interface Format {
type: string | AvailableFormatInfo;
options?: OutputOptions | JpegOptions | PngOptions;
}
export declare interface BooleanOperand {
operand: string | Buffer;
operator: string;
options?: { raw: Raw };
}
export declare interface Linear {
a?: number | null;
b?: number
}
export declare interface JoinChannel {
images: string | Buffer | ArrayLike<string | Buffer>;
options?: SharpOptions;
}
declare type SharpOption<T = string> = false | T;
export declare interface SharpOptions {
size?: Size;
resize?: boolean;
composite?: Array<{ input: string | Buffer } & OverlayOptions>,
extract?: SharpOption<Region>;
trim?: SharpOption<number>;
flatten?: SharpOption<FlattenOptions>;
extend?: SharpOption<number | ExtendOptions>;
negate?: boolean;
rotate?: SharpOption<boolean | number>;
flip?: boolean;
flop?: boolean;
blur?: SharpOption<boolean | number>;
sharpen?: SharpOption<boolean | Sharpen>;
gamma?: SharpOption<boolean | number>;
grayscale?: boolean;
greyscale?: boolean;
normalize?: boolean;
normalise?: boolean;
withMetadata?: SharpOption<WriteableMetadata>;
convolve?: SharpOption<Kernel>;
threshold?: SharpOption<number | Threshold>;
toColourspace?: SharpOption;
toColorspace?: SharpOption;
toFormat?: SharpOption<string | Format>;
ensureAlpha?: boolean;
modulate?: SharpOption<Modulate>;
median?: SharpOption<number>;
boolean?: SharpOption<BooleanOperand>;
linear?: SharpOption<Linear>;
recomb?: SharpOption<Matrix3x3>;
tint?: SharpOption<Color>;
removeAlpha?: boolean;
extractChannel?: SharpOption<number | string>;
joinChannel?: SharpOption<JoinChannel>;
bandbool?: SharpOption;
}
declare interface Sizes extends Size {
suffix: string;
}
export declare interface CloudStorageOptions extends UploadOptions {
bucket: string;
projectId: string;
keyFilename?: string;
filename?: string;
acl?: string;
sizes?: Sizes[];
gzip?: boolean;
}
export declare type MulterOptions = SharpOptions & CloudStorageOptions;
declare class MulterSharp {
constructor(options: MulterOptions)
}
declare function multerSharp(options: MulterOptions): MulterSharp;
export = multerSharp;