-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathindex.d.ts
More file actions
49 lines (43 loc) · 1.38 KB
/
index.d.ts
File metadata and controls
49 lines (43 loc) · 1.38 KB
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
export interface Options {
conversionTimeout?: number;
conversionTimeoutDelta?: number;
uploadTimeout?: number;
downloadTimeout?: number;
proxy?: object;
baseUri?: string;
keepAlive?: boolean;
}
export interface ResultFile {
readonly url: string;
readonly fileName: string;
readonly fileSize: number;
save(filePath: string): Promise<string>;
}
export interface Result {
readonly response: object;
readonly conversionCost: number;
readonly jobId?: string;
readonly file: ResultFile;
readonly files: [ResultFile];
saveFiles(path: string): Promise<[string]>;
}
export interface UploadResult {
readonly fileId: string;
readonly fileName: string;
readonly fileExt: string;
toString(): string;
}
export interface Client {
get(path: string, params?: any, timeout?: number): Promise<any>;
post(path: string, params: any, timeout?: number): Promise<any>;
download(url: string, path: string): Promise<string>;
upload(stream: string | NodeJS.ReadableStream, fileName: string): Promise<UploadResult>;
}
export class ConvertAPI {
client: Client;
constructor (credentials: string, options?: Options);
convert(toFormat: string, params: object, fromFormat?: string, conversionTimeout?: number): Promise<Result>;
getUser(): Promise<object>;
upload(source: string | NodeJS.ReadableStream, fileName?: string): Promise<UploadResult>;
}
export default ConvertAPI;