-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathindex-deno.ts
112 lines (86 loc) · 2.68 KB
/
index-deno.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
import { MultipartBody } from './MultipartBody';
import { type RequestOptions } from '../core';
export const kind: string = 'web';
export type Agent = any;
const _fetch = fetch;
type _fetch = typeof fetch;
export { _fetch as fetch };
const _Request = Request;
type _Request = Request;
export { _Request as Request };
type _RequestInfo = RequestInfo;
export { type _RequestInfo as RequestInfo };
type _RequestInit = RequestInit;
export { type _RequestInit as RequestInit };
const _Response = Response;
type _Response = Response;
export { _Response as Response };
type _ResponseInit = ResponseInit;
export { type _ResponseInit as ResponseInit };
type _ResponseType = ResponseType;
export { type _ResponseType as ResponseType };
type _BodyInit = BodyInit;
export { type _BodyInit as BodyInit };
const _Headers = Headers;
type _Headers = Headers;
export { _Headers as Headers };
type _HeadersInit = HeadersInit;
export { type _HeadersInit as HeadersInit };
type EndingType = 'native' | 'transparent';
export interface BlobPropertyBag {
endings?: EndingType;
type?: string;
}
export interface FilePropertyBag extends BlobPropertyBag {
lastModified?: number;
}
export type FileFromPathOptions = Omit<FilePropertyBag, 'lastModified'>;
const _FormData = FormData;
type _FormData = FormData;
export { _FormData as FormData };
const _File = File;
type _File = File;
export { _File as File };
const _Blob = Blob;
type _Blob = Blob;
export { _Blob as Blob };
export async function getMultipartRequestOptions<T = Record<string, unknown>>(
form: FormData,
opts: RequestOptions<T>,
): Promise<RequestOptions<T>> {
return {
...opts,
body: new MultipartBody(form) as any,
};
}
export function getDefaultAgent(url: string) {
return undefined;
}
export function fileFromPath() {
throw new Error(
'The `fileFromPath` function is only supported in Node. See the README for more details: https://www.github.com/openai/openai-node#file-uploads',
);
}
export const isFsReadStream = (value: any) => false;
export declare class Readable {
readable: boolean;
readonly readableEnded: boolean;
readonly readableFlowing: boolean | null;
readonly readableHighWaterMark: number;
readonly readableLength: number;
readonly readableObjectMode: boolean;
destroyed: boolean;
read(size?: number): any;
pause(): this;
resume(): this;
isPaused(): boolean;
destroy(error?: Error): this;
[Symbol.asyncIterator](): AsyncIterableIterator<any>;
}
export declare class FsReadStream extends Readable {
path: {}; // node type is string | Buffer
}
const _ReadableStream = ReadableStream;
type _ReadableStream = ReadableStream;
export { _ReadableStream as ReadableStream };
export const init = () => {};