/
wasmer_wasi_js.d.ts
215 lines (212 loc) · 5.61 KB
/
wasmer_wasi_js.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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
/* tslint:disable */
/* eslint-disable */
/**
*/
export class JSVirtualFile {
free(): void;
/**
* @returns {BigInt}
*/
lastAccessed(): BigInt;
/**
* @returns {BigInt}
*/
lastModified(): BigInt;
/**
* @returns {BigInt}
*/
createdTime(): BigInt;
/**
* @returns {BigInt}
*/
size(): BigInt;
/**
* @param {BigInt} new_size
*/
setLength(new_size: BigInt): void;
/**
* @returns {Uint8Array}
*/
read(): Uint8Array;
/**
* @returns {string}
*/
readString(): string;
/**
* @param {Uint8Array} buf
* @returns {number}
*/
write(buf: Uint8Array): number;
/**
* @param {string} buf
* @returns {number}
*/
writeString(buf: string): number;
/**
*/
flush(): void;
/**
* @param {number} position
* @returns {number}
*/
seek(position: number): number;
}
/**
*/
export class MemFS {
free(): void;
/**
*/
constructor();
/**
* @param {string} path
* @returns {Array<any>}
*/
readDir(path: string): Array<any>;
/**
* @param {string} path
*/
createDir(path: string): void;
/**
* @param {string} path
*/
removeDir(path: string): void;
/**
* @param {string} path
*/
removeFile(path: string): void;
/**
* @param {string} path
* @param {string} to
*/
rename(path: string, to: string): void;
/**
* @param {string} path
* @returns {object}
*/
metadata(path: string): object;
/**
* @param {string} path
* @param {any} options
* @returns {JSVirtualFile}
*/
open(path: string, options: any): JSVirtualFile;
}
/**
*/
export class WASI {
free(): void;
/**
* @param {any} config
*/
constructor(config: any);
/**
* @param {any} module
* @param {object} imports
* @returns {WebAssembly.Instance}
*/
instantiate(module: any, imports: object): WebAssembly.Instance;
/**
* Start the WASI Instance, it returns the status code when calling the start
* function
* @returns {number}
*/
start(): number;
/**
* Get the stdout buffer
* Note: this method flushes the stdout
* @returns {Uint8Array}
*/
getStdoutBuffer(): Uint8Array;
/**
* Get the stdout data as a string
* Note: this method flushes the stdout
* @returns {string}
*/
getStdoutString(): string;
/**
* Get the stderr buffer
* Note: this method flushes the stderr
* @returns {Uint8Array}
*/
getStderrBuffer(): Uint8Array;
/**
* Get the stderr data as a string
* Note: this method flushes the stderr
* @returns {string}
*/
getStderrString(): string;
/**
* Set the stdin buffer
* @param {Uint8Array} buf
*/
setStdinBuffer(buf: Uint8Array): void;
/**
* Set the stdin data as a string
* @param {string} input
*/
setStdinString(input: string): void;
/**
* @returns {MemFS}
*/
readonly fs: MemFS;
}
/**
* A struct representing an aborted instruction execution, with a message
* indicating the cause.
*/
export class WasmerRuntimeError {
free(): void;
}
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
export interface InitOutput {
readonly memory: WebAssembly.Memory;
readonly __wbg_memfs_free: (a: number) => void;
readonly memfs_new: () => number;
readonly memfs_readDir: (a: number, b: number, c: number) => number;
readonly memfs_createDir: (a: number, b: number, c: number) => void;
readonly memfs_removeDir: (a: number, b: number, c: number) => void;
readonly memfs_removeFile: (a: number, b: number, c: number) => void;
readonly memfs_rename: (a: number, b: number, c: number, d: number, e: number) => void;
readonly memfs_metadata: (a: number, b: number, c: number) => number;
readonly memfs_open: (a: number, b: number, c: number, d: number) => number;
readonly __wbg_jsvirtualfile_free: (a: number) => void;
readonly jsvirtualfile_lastAccessed: (a: number, b: number) => void;
readonly jsvirtualfile_lastModified: (a: number, b: number) => void;
readonly jsvirtualfile_createdTime: (a: number, b: number) => void;
readonly jsvirtualfile_size: (a: number, b: number) => void;
readonly jsvirtualfile_setLength: (a: number, b: number, c: number) => void;
readonly jsvirtualfile_read: (a: number, b: number) => void;
readonly jsvirtualfile_readString: (a: number, b: number) => void;
readonly jsvirtualfile_write: (a: number, b: number, c: number) => number;
readonly jsvirtualfile_writeString: (a: number, b: number, c: number) => number;
readonly jsvirtualfile_flush: (a: number) => void;
readonly jsvirtualfile_seek: (a: number, b: number) => number;
readonly __wbg_wasi_free: (a: number) => void;
readonly wasi_new: (a: number) => number;
readonly wasi_fs: (a: number) => number;
readonly wasi_instantiate: (a: number, b: number, c: number) => number;
readonly wasi_start: (a: number) => number;
readonly wasi_getStdoutBuffer: (a: number, b: number) => void;
readonly wasi_getStdoutString: (a: number, b: number) => void;
readonly wasi_getStderrBuffer: (a: number, b: number) => void;
readonly wasi_getStderrString: (a: number, b: number) => void;
readonly wasi_setStdinBuffer: (a: number, b: number, c: number) => void;
readonly wasi_setStdinString: (a: number, b: number, c: number) => void;
readonly __wbg_wasmerruntimeerror_free: (a: number) => void;
readonly __wbindgen_malloc: (a: number) => number;
readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;
readonly __wbindgen_export_2: WebAssembly.Table;
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
readonly __wbindgen_free: (a: number, b: number) => void;
readonly __wbindgen_exn_store: (a: number) => void;
}
/**
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
* for everything else, calls `WebAssembly.instantiate` directly.
*
* @param {InitInput | Promise<InitInput>} module_or_path
*
* @returns {Promise<InitOutput>}
*/
export default function init (module_or_path?: InitInput | Promise<InitInput>): Promise<InitOutput>;