@bytecodealliance/preview2-shim 0.0.8 → 0.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/lib/browser/cli-base.js +48 -0
- package/lib/browser/clocks.js +44 -0
- package/lib/browser/filesystem.js +134 -141
- package/lib/browser/http.js +114 -0
- package/lib/browser/index.js +15 -37
- package/lib/browser/io.js +60 -20
- package/lib/browser/{console.js → logging.js} +7 -5
- package/lib/browser/poll.js +9 -7
- package/lib/browser/random.js +48 -24
- package/lib/browser/sockets.js +200 -0
- package/lib/nodejs/{preopens.js → cli-base.js} +38 -8
- package/lib/nodejs/clocks.js +44 -0
- package/lib/nodejs/filesystem.js +240 -237
- package/lib/nodejs/http.js +114 -0
- package/lib/nodejs/index.js +15 -37
- package/lib/nodejs/io.js +148 -19
- package/lib/nodejs/{console.js → logging.js} +7 -5
- package/lib/nodejs/poll.js +9 -7
- package/lib/nodejs/random.js +27 -13
- package/lib/nodejs/sockets.js +200 -0
- package/package.json +1 -1
- package/types/exports/{HTTP.d.ts → wasi-http-incoming-handler.d.ts} +1 -1
- package/types/imports/environment.d.ts +14 -1
- package/types/imports/exit.d.ts +4 -1
- package/types/imports/filesystem.d.ts +695 -48
- package/types/imports/handler.d.ts +40 -0
- package/types/imports/insecure-seed.d.ts +22 -0
- package/types/imports/insecure.d.ts +20 -0
- package/types/imports/instance-network.d.ts +4 -1
- package/types/imports/ip-name-lookup.d.ts +66 -9
- package/types/imports/monotonic-clock.d.ts +18 -2
- package/types/imports/network.d.ts +171 -9
- package/types/imports/{default-outgoing-HTTP.d.ts → outgoing-handler.d.ts} +1 -1
- package/types/imports/poll.d.ts +38 -2
- package/types/imports/preopens.d.ts +6 -9
- package/types/imports/random.d.ts +19 -2
- package/types/imports/stderr.d.ts +5 -0
- package/types/imports/stdin.d.ts +5 -0
- package/types/imports/stdout.d.ts +5 -0
- package/types/imports/streams.d.ts +161 -4
- package/types/imports/tcp-create-socket.d.ts +27 -3
- package/types/imports/tcp.d.ts +248 -15
- package/types/imports/timezone.d.ts +60 -2
- package/types/imports/types.d.ts +28 -28
- package/types/imports/udp-create-socket.d.ts +27 -3
- package/types/imports/udp.d.ts +195 -12
- package/types/imports/wall-clock.d.ts +24 -1
- package/types/wasi-command.d.ts +23 -0
- package/types/wasi-proxy.d.ts +10 -44
- package/types/wasi-reactor.d.ts +23 -70
- package/lib/browser/default-outgoing-HTTP.js +0 -3
- package/lib/browser/environment.js +0 -17
- package/lib/browser/exit.js +0 -21
- package/lib/browser/instance-network.js +0 -3
- package/lib/browser/ip-name-lookup.js +0 -23
- package/lib/browser/monotonic-clock.js +0 -14
- package/lib/browser/network.js +0 -3
- package/lib/browser/preopens.js +0 -11
- package/lib/browser/stderr.js +0 -4
- package/lib/browser/streams.js +0 -60
- package/lib/browser/tcp-create-socket.js +0 -3
- package/lib/browser/tcp.js +0 -75
- package/lib/browser/timezone.js +0 -12
- package/lib/browser/types.js +0 -99
- package/lib/browser/udp-create-socket.js +0 -3
- package/lib/browser/udp.js +0 -75
- package/lib/browser/wall-clock.js +0 -9
- package/lib/nodejs/default-outgoing-HTTP.js +0 -3
- package/lib/nodejs/environment.js +0 -19
- package/lib/nodejs/exit.js +0 -3
- package/lib/nodejs/instance-network.js +0 -3
- package/lib/nodejs/ip-name-lookup.js +0 -23
- package/lib/nodejs/monotonic-clock.js +0 -14
- package/lib/nodejs/network.js +0 -3
- package/lib/nodejs/stderr.js +0 -4
- package/lib/nodejs/streams.js +0 -97
- package/lib/nodejs/tcp-create-socket.js +0 -3
- package/lib/nodejs/tcp.js +0 -75
- package/lib/nodejs/timezone.js +0 -12
- package/lib/nodejs/types.js +0 -99
- package/lib/nodejs/udp-create-socket.js +0 -3
- package/lib/nodejs/udp.js +0 -75
- package/lib/nodejs/wall-clock.js +0 -9
- package/types/imports/console.d.ts +0 -17
- package/types/index.d.ts +0 -8
|
@@ -1,210 +1,857 @@
|
|
|
1
|
-
export namespace
|
|
1
|
+
export namespace ImportsFilesystem {
|
|
2
|
+
/**
|
|
3
|
+
* Return a stream for reading from a file.
|
|
4
|
+
*
|
|
5
|
+
* Multiple read, write, and append streams may be active on the same open
|
|
6
|
+
* file and they do not interfere with each other.
|
|
7
|
+
*
|
|
8
|
+
* Note: This allows using `wasi:io/streams.read`, which is similar to `read` in POSIX.
|
|
9
|
+
*/
|
|
2
10
|
export function readViaStream(this: Descriptor, offset: Filesize): InputStream;
|
|
11
|
+
/**
|
|
12
|
+
* Return a stream for writing to a file.
|
|
13
|
+
*
|
|
14
|
+
* Note: This allows using `wasi:io/streams.write`, which is similar to `write` in
|
|
15
|
+
* POSIX.
|
|
16
|
+
*/
|
|
3
17
|
export function writeViaStream(this: Descriptor, offset: Filesize): OutputStream;
|
|
18
|
+
/**
|
|
19
|
+
* Return a stream for appending to a file.
|
|
20
|
+
*
|
|
21
|
+
* Note: This allows using `wasi:io/streams.write`, which is similar to `write` with
|
|
22
|
+
* `O_APPEND` in in POSIX.
|
|
23
|
+
*/
|
|
4
24
|
export function appendViaStream(this: Descriptor): OutputStream;
|
|
25
|
+
/**
|
|
26
|
+
* Provide file advisory information on a descriptor.
|
|
27
|
+
*
|
|
28
|
+
* This is similar to `posix_fadvise` in POSIX.
|
|
29
|
+
*/
|
|
5
30
|
export function advise(this: Descriptor, offset: Filesize, length: Filesize, advice: Advice): void;
|
|
31
|
+
/**
|
|
32
|
+
* Synchronize the data of a file to disk.
|
|
33
|
+
*
|
|
34
|
+
* This function succeeds with no effect if the file descriptor is not
|
|
35
|
+
* opened for writing.
|
|
36
|
+
*
|
|
37
|
+
* Note: This is similar to `fdatasync` in POSIX.
|
|
38
|
+
*/
|
|
6
39
|
export function syncData(this: Descriptor): void;
|
|
40
|
+
/**
|
|
41
|
+
* Get flags associated with a descriptor.
|
|
42
|
+
*
|
|
43
|
+
* Note: This returns similar flags to `fcntl(fd, F_GETFL)` in POSIX.
|
|
44
|
+
*
|
|
45
|
+
* Note: This returns the value that was the `fs_flags` value returned
|
|
46
|
+
* from `fdstat_get` in earlier versions of WASI.
|
|
47
|
+
*/
|
|
7
48
|
export function getFlags(this: Descriptor): DescriptorFlags;
|
|
49
|
+
/**
|
|
50
|
+
* Get the dynamic type of a descriptor.
|
|
51
|
+
*
|
|
52
|
+
* Note: This returns the same value as the `type` field of the `fd-stat`
|
|
53
|
+
* returned by `stat`, `stat-at` and similar.
|
|
54
|
+
*
|
|
55
|
+
* Note: This returns similar flags to the `st_mode & S_IFMT` value provided
|
|
56
|
+
* by `fstat` in POSIX.
|
|
57
|
+
*
|
|
58
|
+
* Note: This returns the value that was the `fs_filetype` value returned
|
|
59
|
+
* from `fdstat_get` in earlier versions of WASI.
|
|
60
|
+
*/
|
|
8
61
|
export function getType(this: Descriptor): DescriptorType;
|
|
62
|
+
/**
|
|
63
|
+
* Adjust the size of an open file. If this increases the file's size, the
|
|
64
|
+
* extra bytes are filled with zeros.
|
|
65
|
+
*
|
|
66
|
+
* Note: This was called `fd_filestat_set_size` in earlier versions of WASI.
|
|
67
|
+
*/
|
|
9
68
|
export function setSize(this: Descriptor, size: Filesize): void;
|
|
69
|
+
/**
|
|
70
|
+
* Adjust the timestamps of an open file or directory.
|
|
71
|
+
*
|
|
72
|
+
* Note: This is similar to `futimens` in POSIX.
|
|
73
|
+
*
|
|
74
|
+
* Note: This was called `fd_filestat_set_times` in earlier versions of WASI.
|
|
75
|
+
*/
|
|
10
76
|
export function setTimes(this: Descriptor, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
|
|
77
|
+
/**
|
|
78
|
+
* Read from a descriptor, without using and updating the descriptor's offset.
|
|
79
|
+
*
|
|
80
|
+
* This function returns a list of bytes containing the data that was
|
|
81
|
+
* read, along with a bool which, when true, indicates that the end of the
|
|
82
|
+
* file was reached. The returned list will contain up to `length` bytes; it
|
|
83
|
+
* may return fewer than requested, if the end of the file is reached or
|
|
84
|
+
* if the I/O operation is interrupted.
|
|
85
|
+
*
|
|
86
|
+
* In the future, this may change to return a `stream<u8, error-code>`.
|
|
87
|
+
*
|
|
88
|
+
* Note: This is similar to `pread` in POSIX.
|
|
89
|
+
*/
|
|
11
90
|
export function read(this: Descriptor, length: Filesize, offset: Filesize): [Uint8Array | ArrayBuffer, boolean];
|
|
91
|
+
/**
|
|
92
|
+
* Write to a descriptor, without using and updating the descriptor's offset.
|
|
93
|
+
*
|
|
94
|
+
* It is valid to write past the end of a file; the file is extended to the
|
|
95
|
+
* extent of the write, with bytes between the previous end and the start of
|
|
96
|
+
* the write set to zero.
|
|
97
|
+
*
|
|
98
|
+
* In the future, this may change to take a `stream<u8, error-code>`.
|
|
99
|
+
*
|
|
100
|
+
* Note: This is similar to `pwrite` in POSIX.
|
|
101
|
+
*/
|
|
12
102
|
export function write(this: Descriptor, buffer: Uint8Array, offset: Filesize): Filesize;
|
|
103
|
+
/**
|
|
104
|
+
* Read directory entries from a directory.
|
|
105
|
+
*
|
|
106
|
+
* On filesystems where directories contain entries referring to themselves
|
|
107
|
+
* and their parents, often named `.` and `..` respectively, these entries
|
|
108
|
+
* are omitted.
|
|
109
|
+
*
|
|
110
|
+
* This always returns a new stream which starts at the beginning of the
|
|
111
|
+
* directory. Multiple streams may be active on the same directory, and they
|
|
112
|
+
* do not interfere with each other.
|
|
113
|
+
*/
|
|
13
114
|
export function readDirectory(this: Descriptor): DirectoryEntryStream;
|
|
115
|
+
/**
|
|
116
|
+
* Synchronize the data and metadata of a file to disk.
|
|
117
|
+
*
|
|
118
|
+
* This function succeeds with no effect if the file descriptor is not
|
|
119
|
+
* opened for writing.
|
|
120
|
+
*
|
|
121
|
+
* Note: This is similar to `fsync` in POSIX.
|
|
122
|
+
*/
|
|
14
123
|
export function sync(this: Descriptor): void;
|
|
124
|
+
/**
|
|
125
|
+
* Create a directory.
|
|
126
|
+
*
|
|
127
|
+
* Note: This is similar to `mkdirat` in POSIX.
|
|
128
|
+
*/
|
|
15
129
|
export function createDirectoryAt(this: Descriptor, path: string): void;
|
|
130
|
+
/**
|
|
131
|
+
* Return the attributes of an open file or directory.
|
|
132
|
+
*
|
|
133
|
+
* Note: This is similar to `fstat` in POSIX.
|
|
134
|
+
*
|
|
135
|
+
* Note: This was called `fd_filestat_get` in earlier versions of WASI.
|
|
136
|
+
*/
|
|
16
137
|
export function stat(this: Descriptor): DescriptorStat;
|
|
138
|
+
/**
|
|
139
|
+
* Return the attributes of a file or directory.
|
|
140
|
+
*
|
|
141
|
+
* Note: This is similar to `fstatat` in POSIX.
|
|
142
|
+
*
|
|
143
|
+
* Note: This was called `path_filestat_get` in earlier versions of WASI.
|
|
144
|
+
*/
|
|
17
145
|
export function statAt(this: Descriptor, pathFlags: PathFlags, path: string): DescriptorStat;
|
|
146
|
+
/**
|
|
147
|
+
* Adjust the timestamps of a file or directory.
|
|
148
|
+
*
|
|
149
|
+
* Note: This is similar to `utimensat` in POSIX.
|
|
150
|
+
*
|
|
151
|
+
* Note: This was called `path_filestat_set_times` in earlier versions of
|
|
152
|
+
* WASI.
|
|
153
|
+
*/
|
|
18
154
|
export function setTimesAt(this: Descriptor, pathFlags: PathFlags, path: string, dataAccessTimestamp: NewTimestamp, dataModificationTimestamp: NewTimestamp): void;
|
|
155
|
+
/**
|
|
156
|
+
* Create a hard link.
|
|
157
|
+
*
|
|
158
|
+
* Note: This is similar to `linkat` in POSIX.
|
|
159
|
+
*/
|
|
19
160
|
export function linkAt(this: Descriptor, oldPathFlags: PathFlags, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
161
|
+
/**
|
|
162
|
+
* Open a file or directory.
|
|
163
|
+
*
|
|
164
|
+
* The returned descriptor is not guaranteed to be the lowest-numbered
|
|
165
|
+
* descriptor not currently open/ it is randomized to prevent applications
|
|
166
|
+
* from depending on making assumptions about indexes, since this is
|
|
167
|
+
* error-prone in multi-threaded contexts. The returned descriptor is
|
|
168
|
+
* guaranteed to be less than 2**31.
|
|
169
|
+
*
|
|
170
|
+
* If `flags` contains `descriptor-flags::mutate-directory`, and the base
|
|
171
|
+
* descriptor doesn't have `descriptor-flags::mutate-directory` set,
|
|
172
|
+
* `open-at` fails with `error-code::read-only`.
|
|
173
|
+
*
|
|
174
|
+
* If `flags` contains `write` or `mutate-directory`, or `open-flags`
|
|
175
|
+
* contains `truncate` or `create`, and the base descriptor doesn't have
|
|
176
|
+
* `descriptor-flags::mutate-directory` set, `open-at` fails with
|
|
177
|
+
* `error-code::read-only`.
|
|
178
|
+
*
|
|
179
|
+
* Note: This is similar to `openat` in POSIX.
|
|
180
|
+
*/
|
|
20
181
|
export function openAt(this: Descriptor, pathFlags: PathFlags, path: string, openFlags: OpenFlags, flags: DescriptorFlags, modes: Modes): Descriptor;
|
|
182
|
+
/**
|
|
183
|
+
* Read the contents of a symbolic link.
|
|
184
|
+
*
|
|
185
|
+
* If the contents contain an absolute or rooted path in the underlying
|
|
186
|
+
* filesystem, this function fails with `error-code::not-permitted`.
|
|
187
|
+
*
|
|
188
|
+
* Note: This is similar to `readlinkat` in POSIX.
|
|
189
|
+
*/
|
|
21
190
|
export function readlinkAt(this: Descriptor, path: string): string;
|
|
191
|
+
/**
|
|
192
|
+
* Remove a directory.
|
|
193
|
+
*
|
|
194
|
+
* Return `error-code::not-empty` if the directory is not empty.
|
|
195
|
+
*
|
|
196
|
+
* Note: This is similar to `unlinkat(fd, path, AT_REMOVEDIR)` in POSIX.
|
|
197
|
+
*/
|
|
22
198
|
export function removeDirectoryAt(this: Descriptor, path: string): void;
|
|
199
|
+
/**
|
|
200
|
+
* Rename a filesystem object.
|
|
201
|
+
*
|
|
202
|
+
* Note: This is similar to `renameat` in POSIX.
|
|
203
|
+
*/
|
|
23
204
|
export function renameAt(this: Descriptor, oldPath: string, newDescriptor: Descriptor, newPath: string): void;
|
|
205
|
+
/**
|
|
206
|
+
* Create a symbolic link (also known as a "symlink").
|
|
207
|
+
*
|
|
208
|
+
* If `old-path` starts with `/`, the function fails with
|
|
209
|
+
* `error-code::not-permitted`.
|
|
210
|
+
*
|
|
211
|
+
* Note: This is similar to `symlinkat` in POSIX.
|
|
212
|
+
*/
|
|
24
213
|
export function symlinkAt(this: Descriptor, oldPath: string, newPath: string): void;
|
|
214
|
+
/**
|
|
215
|
+
* Check accessibility of a filesystem path.
|
|
216
|
+
*
|
|
217
|
+
* Check whether the given filesystem path names an object which is
|
|
218
|
+
* readable, writable, or executable, or whether it exists.
|
|
219
|
+
*
|
|
220
|
+
* This does not a guarantee that subsequent accesses will succeed, as
|
|
221
|
+
* filesystem permissions may be modified asynchronously by external
|
|
222
|
+
* entities.
|
|
223
|
+
*
|
|
224
|
+
* Note: This is similar to `faccessat` with the `AT_EACCESS` flag in POSIX.
|
|
225
|
+
*/
|
|
226
|
+
export function accessAt(this: Descriptor, pathFlags: PathFlags, path: string, type: AccessType): void;
|
|
227
|
+
/**
|
|
228
|
+
* Unlink a filesystem object that is not a directory.
|
|
229
|
+
*
|
|
230
|
+
* Return `error-code::is-directory` if the path refers to a directory.
|
|
231
|
+
* Note: This is similar to `unlinkat(fd, path, 0)` in POSIX.
|
|
232
|
+
*/
|
|
25
233
|
export function unlinkFileAt(this: Descriptor, path: string): void;
|
|
234
|
+
/**
|
|
235
|
+
* Change the permissions of a filesystem object that is not a directory.
|
|
236
|
+
*
|
|
237
|
+
* Note that the ultimate meanings of these permissions is
|
|
238
|
+
* filesystem-specific.
|
|
239
|
+
*
|
|
240
|
+
* Note: This is similar to `fchmodat` in POSIX.
|
|
241
|
+
*/
|
|
26
242
|
export function changeFilePermissionsAt(this: Descriptor, pathFlags: PathFlags, path: string, modes: Modes): void;
|
|
243
|
+
/**
|
|
244
|
+
* Change the permissions of a directory.
|
|
245
|
+
*
|
|
246
|
+
* Note that the ultimate meanings of these permissions is
|
|
247
|
+
* filesystem-specific.
|
|
248
|
+
*
|
|
249
|
+
* Unlike in POSIX, the `executable` flag is not reinterpreted as a "search"
|
|
250
|
+
* flag. `read` on a directory implies readability and searchability, and
|
|
251
|
+
* `execute` is not valid for directories.
|
|
252
|
+
*
|
|
253
|
+
* Note: This is similar to `fchmodat` in POSIX.
|
|
254
|
+
*/
|
|
27
255
|
export function changeDirectoryPermissionsAt(this: Descriptor, pathFlags: PathFlags, path: string, modes: Modes): void;
|
|
256
|
+
/**
|
|
257
|
+
* Request a shared advisory lock for an open file.
|
|
258
|
+
*
|
|
259
|
+
* This requests a *shared* lock; more than one shared lock can be held for
|
|
260
|
+
* a file at the same time.
|
|
261
|
+
*
|
|
262
|
+
* If the open file has an exclusive lock, this function downgrades the lock
|
|
263
|
+
* to a shared lock. If it has a shared lock, this function has no effect.
|
|
264
|
+
*
|
|
265
|
+
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
266
|
+
* by other programs that don't hold the lock.
|
|
267
|
+
*
|
|
268
|
+
* It is unspecified how shared locks interact with locks acquired by
|
|
269
|
+
* non-WASI programs.
|
|
270
|
+
*
|
|
271
|
+
* This function blocks until the lock can be acquired.
|
|
272
|
+
*
|
|
273
|
+
* Not all filesystems support locking; on filesystems which don't support
|
|
274
|
+
* locking, this function returns `error-code::unsupported`.
|
|
275
|
+
*
|
|
276
|
+
* Note: This is similar to `flock(fd, LOCK_SH)` in Unix.
|
|
277
|
+
*/
|
|
28
278
|
export function lockShared(this: Descriptor): void;
|
|
279
|
+
/**
|
|
280
|
+
* Request an exclusive advisory lock for an open file.
|
|
281
|
+
*
|
|
282
|
+
* This requests an *exclusive* lock; no other locks may be held for the
|
|
283
|
+
* file while an exclusive lock is held.
|
|
284
|
+
*
|
|
285
|
+
* If the open file has a shared lock and there are no exclusive locks held
|
|
286
|
+
* for the file, this function upgrades the lock to an exclusive lock. If the
|
|
287
|
+
* open file already has an exclusive lock, this function has no effect.
|
|
288
|
+
*
|
|
289
|
+
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
290
|
+
* by other programs that don't hold the lock.
|
|
291
|
+
*
|
|
292
|
+
* It is unspecified whether this function succeeds if the file descriptor
|
|
293
|
+
* is not opened for writing. It is unspecified how exclusive locks interact
|
|
294
|
+
* with locks acquired by non-WASI programs.
|
|
295
|
+
*
|
|
296
|
+
* This function blocks until the lock can be acquired.
|
|
297
|
+
*
|
|
298
|
+
* Not all filesystems support locking; on filesystems which don't support
|
|
299
|
+
* locking, this function returns `error-code::unsupported`.
|
|
300
|
+
*
|
|
301
|
+
* Note: This is similar to `flock(fd, LOCK_EX)` in Unix.
|
|
302
|
+
*/
|
|
29
303
|
export function lockExclusive(this: Descriptor): void;
|
|
304
|
+
/**
|
|
305
|
+
* Request a shared advisory lock for an open file.
|
|
306
|
+
*
|
|
307
|
+
* This requests a *shared* lock; more than one shared lock can be held for
|
|
308
|
+
* a file at the same time.
|
|
309
|
+
*
|
|
310
|
+
* If the open file has an exclusive lock, this function downgrades the lock
|
|
311
|
+
* to a shared lock. If it has a shared lock, this function has no effect.
|
|
312
|
+
*
|
|
313
|
+
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
314
|
+
* by other programs that don't hold the lock.
|
|
315
|
+
*
|
|
316
|
+
* It is unspecified how shared locks interact with locks acquired by
|
|
317
|
+
* non-WASI programs.
|
|
318
|
+
*
|
|
319
|
+
* This function returns `error-code::would-block` if the lock cannot be
|
|
320
|
+
* acquired.
|
|
321
|
+
*
|
|
322
|
+
* Not all filesystems support locking; on filesystems which don't support
|
|
323
|
+
* locking, this function returns `error-code::unsupported`.
|
|
324
|
+
*
|
|
325
|
+
* Note: This is similar to `flock(fd, LOCK_SH | LOCK_NB)` in Unix.
|
|
326
|
+
*/
|
|
30
327
|
export function tryLockShared(this: Descriptor): void;
|
|
328
|
+
/**
|
|
329
|
+
* Request an exclusive advisory lock for an open file.
|
|
330
|
+
*
|
|
331
|
+
* This requests an *exclusive* lock; no other locks may be held for the
|
|
332
|
+
* file while an exclusive lock is held.
|
|
333
|
+
*
|
|
334
|
+
* If the open file has a shared lock and there are no exclusive locks held
|
|
335
|
+
* for the file, this function upgrades the lock to an exclusive lock. If the
|
|
336
|
+
* open file already has an exclusive lock, this function has no effect.
|
|
337
|
+
*
|
|
338
|
+
* This requests an *advisory* lock, meaning that the file could be accessed
|
|
339
|
+
* by other programs that don't hold the lock.
|
|
340
|
+
*
|
|
341
|
+
* It is unspecified whether this function succeeds if the file descriptor
|
|
342
|
+
* is not opened for writing. It is unspecified how exclusive locks interact
|
|
343
|
+
* with locks acquired by non-WASI programs.
|
|
344
|
+
*
|
|
345
|
+
* This function returns `error-code::would-block` if the lock cannot be
|
|
346
|
+
* acquired.
|
|
347
|
+
*
|
|
348
|
+
* Not all filesystems support locking; on filesystems which don't support
|
|
349
|
+
* locking, this function returns `error-code::unsupported`.
|
|
350
|
+
*
|
|
351
|
+
* Note: This is similar to `flock(fd, LOCK_EX | LOCK_NB)` in Unix.
|
|
352
|
+
*/
|
|
31
353
|
export function tryLockExclusive(this: Descriptor): void;
|
|
354
|
+
/**
|
|
355
|
+
* Release a shared or exclusive lock on an open file.
|
|
356
|
+
*
|
|
357
|
+
* Note: This is similar to `flock(fd, LOCK_UN)` in Unix.
|
|
358
|
+
*/
|
|
32
359
|
export function unlock(this: Descriptor): void;
|
|
360
|
+
/**
|
|
361
|
+
* Dispose of the specified `descriptor`, after which it may no longer
|
|
362
|
+
* be used.
|
|
363
|
+
*/
|
|
33
364
|
export function dropDescriptor(this: Descriptor): void;
|
|
365
|
+
/**
|
|
366
|
+
* Read a single directory entry from a `directory-entry-stream`.
|
|
367
|
+
*/
|
|
34
368
|
export function readDirectoryEntry(this: DirectoryEntryStream): DirectoryEntry | null;
|
|
369
|
+
/**
|
|
370
|
+
* Dispose of the specified `directory-entry-stream`, after which it may no longer
|
|
371
|
+
* be used.
|
|
372
|
+
*/
|
|
35
373
|
export function dropDirectoryEntryStream(this: DirectoryEntryStream): void;
|
|
36
374
|
}
|
|
37
|
-
export type Descriptor = number;
|
|
38
|
-
export type Filesize = bigint;
|
|
39
375
|
import type { InputStream } from '../imports/streams';
|
|
40
376
|
export { InputStream };
|
|
41
377
|
import type { OutputStream } from '../imports/streams';
|
|
42
378
|
export { OutputStream };
|
|
379
|
+
import type { Datetime } from '../imports/wall-clock';
|
|
380
|
+
export { Datetime };
|
|
43
381
|
/**
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
* ## `"normal"`
|
|
47
|
-
*
|
|
48
|
-
* ## `"sequential"`
|
|
49
|
-
*
|
|
50
|
-
* ## `"random"`
|
|
51
|
-
*
|
|
52
|
-
* ## `"will-need"`
|
|
53
|
-
*
|
|
54
|
-
* ## `"dont-need"`
|
|
55
|
-
*
|
|
56
|
-
* ## `"no-reuse"`
|
|
382
|
+
* Flags determining the method of how paths are resolved.
|
|
57
383
|
*/
|
|
58
|
-
export
|
|
384
|
+
export interface PathFlags {
|
|
385
|
+
/**
|
|
386
|
+
* As long as the resolved path corresponds to a symbolic link, it is
|
|
387
|
+
* expanded.
|
|
388
|
+
*/
|
|
389
|
+
symlinkFollow?: boolean,
|
|
390
|
+
}
|
|
391
|
+
/**
|
|
392
|
+
* Open flags used by `open-at`.
|
|
393
|
+
*/
|
|
394
|
+
export interface OpenFlags {
|
|
395
|
+
/**
|
|
396
|
+
* Create file if it does not exist, similar to `O_CREAT` in POSIX.
|
|
397
|
+
*/
|
|
398
|
+
create?: boolean,
|
|
399
|
+
/**
|
|
400
|
+
* Fail if not a directory, similar to `O_DIRECTORY` in POSIX.
|
|
401
|
+
*/
|
|
402
|
+
directory?: boolean,
|
|
403
|
+
/**
|
|
404
|
+
* Fail if file already exists, similar to `O_EXCL` in POSIX.
|
|
405
|
+
*/
|
|
406
|
+
exclusive?: boolean,
|
|
407
|
+
/**
|
|
408
|
+
* Truncate file to size 0, similar to `O_TRUNC` in POSIX.
|
|
409
|
+
*/
|
|
410
|
+
truncate?: boolean,
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* Permissions mode used by `open-at`, `change-file-permissions-at`, and
|
|
414
|
+
* similar.
|
|
415
|
+
*/
|
|
416
|
+
export interface Modes {
|
|
417
|
+
/**
|
|
418
|
+
* True if the resource is considered readable by the containing
|
|
419
|
+
* filesystem.
|
|
420
|
+
*/
|
|
421
|
+
readable?: boolean,
|
|
422
|
+
/**
|
|
423
|
+
* True if the resource is considered writable by the containing
|
|
424
|
+
* filesystem.
|
|
425
|
+
*/
|
|
426
|
+
writable?: boolean,
|
|
427
|
+
/**
|
|
428
|
+
* True if the resource is considered executable by the containing
|
|
429
|
+
* filesystem. This does not apply to directories.
|
|
430
|
+
*/
|
|
431
|
+
executable?: boolean,
|
|
432
|
+
}
|
|
433
|
+
/**
|
|
434
|
+
* Number of hard links to an inode.
|
|
435
|
+
*/
|
|
436
|
+
export type LinkCount = bigint;
|
|
437
|
+
/**
|
|
438
|
+
* Filesystem object serial number that is unique within its file system.
|
|
439
|
+
*/
|
|
440
|
+
export type Inode = bigint;
|
|
441
|
+
/**
|
|
442
|
+
* File size or length of a region within a file.
|
|
443
|
+
*/
|
|
444
|
+
export type Filesize = bigint;
|
|
59
445
|
/**
|
|
446
|
+
* Error codes returned by functions, similar to `errno` in POSIX.
|
|
447
|
+
* Not all of these error codes are returned by the functions provided by this
|
|
448
|
+
* API; some are used in higher-level library layers, and others are provided
|
|
449
|
+
* merely for alignment with POSIX.
|
|
450
|
+
*
|
|
60
451
|
* # Variants
|
|
61
452
|
*
|
|
62
453
|
* ## `"access"`
|
|
63
454
|
*
|
|
455
|
+
* Permission denied, similar to `EACCES` in POSIX.
|
|
456
|
+
*
|
|
64
457
|
* ## `"would-block"`
|
|
65
458
|
*
|
|
459
|
+
* Resource unavailable, or operation would block, similar to `EAGAIN` and `EWOULDBLOCK` in POSIX.
|
|
460
|
+
*
|
|
66
461
|
* ## `"already"`
|
|
67
462
|
*
|
|
463
|
+
* Connection already in progress, similar to `EALREADY` in POSIX.
|
|
464
|
+
*
|
|
68
465
|
* ## `"bad-descriptor"`
|
|
69
466
|
*
|
|
467
|
+
* Bad descriptor, similar to `EBADF` in POSIX.
|
|
468
|
+
*
|
|
70
469
|
* ## `"busy"`
|
|
71
470
|
*
|
|
471
|
+
* Device or resource busy, similar to `EBUSY` in POSIX.
|
|
472
|
+
*
|
|
72
473
|
* ## `"deadlock"`
|
|
73
474
|
*
|
|
475
|
+
* Resource deadlock would occur, similar to `EDEADLK` in POSIX.
|
|
476
|
+
*
|
|
74
477
|
* ## `"quota"`
|
|
75
478
|
*
|
|
479
|
+
* Storage quota exceeded, similar to `EDQUOT` in POSIX.
|
|
480
|
+
*
|
|
76
481
|
* ## `"exist"`
|
|
77
482
|
*
|
|
483
|
+
* File exists, similar to `EEXIST` in POSIX.
|
|
484
|
+
*
|
|
78
485
|
* ## `"file-too-large"`
|
|
79
486
|
*
|
|
487
|
+
* File too large, similar to `EFBIG` in POSIX.
|
|
488
|
+
*
|
|
80
489
|
* ## `"illegal-byte-sequence"`
|
|
81
490
|
*
|
|
491
|
+
* Illegal byte sequence, similar to `EILSEQ` in POSIX.
|
|
492
|
+
*
|
|
82
493
|
* ## `"in-progress"`
|
|
83
494
|
*
|
|
495
|
+
* Operation in progress, similar to `EINPROGRESS` in POSIX.
|
|
496
|
+
*
|
|
84
497
|
* ## `"interrupted"`
|
|
85
498
|
*
|
|
499
|
+
* Interrupted function, similar to `EINTR` in POSIX.
|
|
500
|
+
*
|
|
86
501
|
* ## `"invalid"`
|
|
87
502
|
*
|
|
503
|
+
* Invalid argument, similar to `EINVAL` in POSIX.
|
|
504
|
+
*
|
|
88
505
|
* ## `"io"`
|
|
89
506
|
*
|
|
507
|
+
* I/O error, similar to `EIO` in POSIX.
|
|
508
|
+
*
|
|
90
509
|
* ## `"is-directory"`
|
|
91
510
|
*
|
|
511
|
+
* Is a directory, similar to `EISDIR` in POSIX.
|
|
512
|
+
*
|
|
92
513
|
* ## `"loop"`
|
|
93
514
|
*
|
|
515
|
+
* Too many levels of symbolic links, similar to `ELOOP` in POSIX.
|
|
516
|
+
*
|
|
94
517
|
* ## `"too-many-links"`
|
|
95
518
|
*
|
|
519
|
+
* Too many links, similar to `EMLINK` in POSIX.
|
|
520
|
+
*
|
|
96
521
|
* ## `"message-size"`
|
|
97
522
|
*
|
|
523
|
+
* Message too large, similar to `EMSGSIZE` in POSIX.
|
|
524
|
+
*
|
|
98
525
|
* ## `"name-too-long"`
|
|
99
526
|
*
|
|
527
|
+
* Filename too long, similar to `ENAMETOOLONG` in POSIX.
|
|
528
|
+
*
|
|
100
529
|
* ## `"no-device"`
|
|
101
530
|
*
|
|
531
|
+
* No such device, similar to `ENODEV` in POSIX.
|
|
532
|
+
*
|
|
102
533
|
* ## `"no-entry"`
|
|
103
534
|
*
|
|
535
|
+
* No such file or directory, similar to `ENOENT` in POSIX.
|
|
536
|
+
*
|
|
104
537
|
* ## `"no-lock"`
|
|
105
538
|
*
|
|
539
|
+
* No locks available, similar to `ENOLCK` in POSIX.
|
|
540
|
+
*
|
|
106
541
|
* ## `"insufficient-memory"`
|
|
107
542
|
*
|
|
543
|
+
* Not enough space, similar to `ENOMEM` in POSIX.
|
|
544
|
+
*
|
|
108
545
|
* ## `"insufficient-space"`
|
|
109
546
|
*
|
|
547
|
+
* No space left on device, similar to `ENOSPC` in POSIX.
|
|
548
|
+
*
|
|
110
549
|
* ## `"not-directory"`
|
|
111
550
|
*
|
|
551
|
+
* Not a directory or a symbolic link to a directory, similar to `ENOTDIR` in POSIX.
|
|
552
|
+
*
|
|
112
553
|
* ## `"not-empty"`
|
|
113
554
|
*
|
|
555
|
+
* Directory not empty, similar to `ENOTEMPTY` in POSIX.
|
|
556
|
+
*
|
|
114
557
|
* ## `"not-recoverable"`
|
|
115
558
|
*
|
|
559
|
+
* State not recoverable, similar to `ENOTRECOVERABLE` in POSIX.
|
|
560
|
+
*
|
|
116
561
|
* ## `"unsupported"`
|
|
117
562
|
*
|
|
563
|
+
* Not supported, similar to `ENOTSUP` and `ENOSYS` in POSIX.
|
|
564
|
+
*
|
|
118
565
|
* ## `"no-tty"`
|
|
119
566
|
*
|
|
567
|
+
* Inappropriate I/O control operation, similar to `ENOTTY` in POSIX.
|
|
568
|
+
*
|
|
120
569
|
* ## `"no-such-device"`
|
|
121
570
|
*
|
|
571
|
+
* No such device or address, similar to `ENXIO` in POSIX.
|
|
572
|
+
*
|
|
122
573
|
* ## `"overflow"`
|
|
123
574
|
*
|
|
575
|
+
* Value too large to be stored in data type, similar to `EOVERFLOW` in POSIX.
|
|
576
|
+
*
|
|
124
577
|
* ## `"not-permitted"`
|
|
125
578
|
*
|
|
579
|
+
* Operation not permitted, similar to `EPERM` in POSIX.
|
|
580
|
+
*
|
|
126
581
|
* ## `"pipe"`
|
|
127
582
|
*
|
|
583
|
+
* Broken pipe, similar to `EPIPE` in POSIX.
|
|
584
|
+
*
|
|
128
585
|
* ## `"read-only"`
|
|
129
586
|
*
|
|
587
|
+
* Read-only file system, similar to `EROFS` in POSIX.
|
|
588
|
+
*
|
|
130
589
|
* ## `"invalid-seek"`
|
|
131
590
|
*
|
|
591
|
+
* Invalid seek, similar to `ESPIPE` in POSIX.
|
|
592
|
+
*
|
|
132
593
|
* ## `"text-file-busy"`
|
|
133
594
|
*
|
|
595
|
+
* Text file busy, similar to `ETXTBSY` in POSIX.
|
|
596
|
+
*
|
|
134
597
|
* ## `"cross-device"`
|
|
598
|
+
*
|
|
599
|
+
* Cross-device link, similar to `EXDEV` in POSIX.
|
|
135
600
|
*/
|
|
136
601
|
export type ErrorCode = 'access' | 'would-block' | 'already' | 'bad-descriptor' | 'busy' | 'deadlock' | 'quota' | 'exist' | 'file-too-large' | 'illegal-byte-sequence' | 'in-progress' | 'interrupted' | 'invalid' | 'io' | 'is-directory' | 'loop' | 'too-many-links' | 'message-size' | 'name-too-long' | 'no-device' | 'no-entry' | 'no-lock' | 'insufficient-memory' | 'insufficient-space' | 'not-directory' | 'not-empty' | 'not-recoverable' | 'unsupported' | 'no-tty' | 'no-such-device' | 'overflow' | 'not-permitted' | 'pipe' | 'read-only' | 'invalid-seek' | 'text-file-busy' | 'cross-device';
|
|
137
|
-
export interface DescriptorFlags {
|
|
138
|
-
read?: boolean,
|
|
139
|
-
write?: boolean,
|
|
140
|
-
fileIntegritySync?: boolean,
|
|
141
|
-
dataIntegritySync?: boolean,
|
|
142
|
-
requestedWriteSync?: boolean,
|
|
143
|
-
mutateDirectory?: boolean,
|
|
144
|
-
}
|
|
145
602
|
/**
|
|
603
|
+
* A stream of directory entries.
|
|
604
|
+
*
|
|
605
|
+
* This [represents a stream of `dir-entry`](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Streams).
|
|
606
|
+
*/
|
|
607
|
+
export type DirectoryEntryStream = number;
|
|
608
|
+
/**
|
|
609
|
+
* Identifier for a device containing a file system. Can be used in
|
|
610
|
+
* combination with `inode` to uniquely identify a file or directory in
|
|
611
|
+
* the filesystem.
|
|
612
|
+
*/
|
|
613
|
+
export type Device = bigint;
|
|
614
|
+
/**
|
|
615
|
+
* The type of a filesystem object referenced by a descriptor.
|
|
616
|
+
*
|
|
617
|
+
* Note: This was called `filetype` in earlier versions of WASI.
|
|
618
|
+
*
|
|
146
619
|
* # Variants
|
|
147
620
|
*
|
|
148
621
|
* ## `"unknown"`
|
|
149
622
|
*
|
|
623
|
+
* The type of the descriptor or file is unknown or is different from
|
|
624
|
+
* any of the other types specified.
|
|
625
|
+
*
|
|
150
626
|
* ## `"block-device"`
|
|
151
627
|
*
|
|
628
|
+
* The descriptor refers to a block device inode.
|
|
629
|
+
*
|
|
152
630
|
* ## `"character-device"`
|
|
153
631
|
*
|
|
632
|
+
* The descriptor refers to a character device inode.
|
|
633
|
+
*
|
|
154
634
|
* ## `"directory"`
|
|
155
635
|
*
|
|
636
|
+
* The descriptor refers to a directory inode.
|
|
637
|
+
*
|
|
156
638
|
* ## `"fifo"`
|
|
157
639
|
*
|
|
640
|
+
* The descriptor refers to a named pipe.
|
|
641
|
+
*
|
|
158
642
|
* ## `"symbolic-link"`
|
|
159
643
|
*
|
|
644
|
+
* The file refers to a symbolic link inode.
|
|
645
|
+
*
|
|
160
646
|
* ## `"regular-file"`
|
|
161
647
|
*
|
|
648
|
+
* The descriptor refers to a regular file inode.
|
|
649
|
+
*
|
|
162
650
|
* ## `"socket"`
|
|
651
|
+
*
|
|
652
|
+
* The descriptor refers to a socket.
|
|
163
653
|
*/
|
|
164
654
|
export type DescriptorType = 'unknown' | 'block-device' | 'character-device' | 'directory' | 'fifo' | 'symbolic-link' | 'regular-file' | 'socket';
|
|
165
|
-
|
|
166
|
-
|
|
655
|
+
/**
|
|
656
|
+
* A directory entry.
|
|
657
|
+
*/
|
|
658
|
+
export interface DirectoryEntry {
|
|
659
|
+
/**
|
|
660
|
+
* The serial number of the object referred to by this directory entry.
|
|
661
|
+
* May be none if the inode value is not known.
|
|
662
|
+
*
|
|
663
|
+
* When this is none, libc implementations might do an extra `stat-at`
|
|
664
|
+
* call to retrieve the inode number to fill their `d_ino` fields, so
|
|
665
|
+
* implementations which can set this to a non-none value should do so.
|
|
666
|
+
*/
|
|
667
|
+
inode?: Inode,
|
|
668
|
+
/**
|
|
669
|
+
* The type of the file referred to by this directory entry.
|
|
670
|
+
*/
|
|
671
|
+
type: DescriptorType,
|
|
672
|
+
/**
|
|
673
|
+
* The name of the object.
|
|
674
|
+
*/
|
|
675
|
+
name: string,
|
|
676
|
+
}
|
|
677
|
+
/**
|
|
678
|
+
* Descriptor flags.
|
|
679
|
+
*
|
|
680
|
+
* Note: This was called `fdflags` in earlier versions of WASI.
|
|
681
|
+
*/
|
|
682
|
+
export interface DescriptorFlags {
|
|
683
|
+
/**
|
|
684
|
+
* Read mode: Data can be read.
|
|
685
|
+
*/
|
|
686
|
+
read?: boolean,
|
|
687
|
+
/**
|
|
688
|
+
* Write mode: Data can be written to.
|
|
689
|
+
*/
|
|
690
|
+
write?: boolean,
|
|
691
|
+
/**
|
|
692
|
+
* Request that writes be performed according to synchronized I/O file
|
|
693
|
+
* integrity completion. The data stored in the file and the file's
|
|
694
|
+
* metadata are synchronized. This is similar to `O_SYNC` in POSIX.
|
|
695
|
+
*
|
|
696
|
+
* The precise semantics of this operation have not yet been defined for
|
|
697
|
+
* WASI. At this time, it should be interpreted as a request, and not a
|
|
698
|
+
* requirement.
|
|
699
|
+
*/
|
|
700
|
+
fileIntegritySync?: boolean,
|
|
701
|
+
/**
|
|
702
|
+
* Request that writes be performed according to synchronized I/O data
|
|
703
|
+
* integrity completion. Only the data stored in the file is
|
|
704
|
+
* synchronized. This is similar to `O_DSYNC` in POSIX.
|
|
705
|
+
*
|
|
706
|
+
* The precise semantics of this operation have not yet been defined for
|
|
707
|
+
* WASI. At this time, it should be interpreted as a request, and not a
|
|
708
|
+
* requirement.
|
|
709
|
+
*/
|
|
710
|
+
dataIntegritySync?: boolean,
|
|
711
|
+
/**
|
|
712
|
+
* Requests that reads be performed at the same level of integrety
|
|
713
|
+
* requested for writes. This is similar to `O_RSYNC` in POSIX.
|
|
714
|
+
*
|
|
715
|
+
* The precise semantics of this operation have not yet been defined for
|
|
716
|
+
* WASI. At this time, it should be interpreted as a request, and not a
|
|
717
|
+
* requirement.
|
|
718
|
+
*/
|
|
719
|
+
requestedWriteSync?: boolean,
|
|
720
|
+
/**
|
|
721
|
+
* Mutating directories mode: Directory contents may be mutated.
|
|
722
|
+
*
|
|
723
|
+
* When this flag is unset on a descriptor, operations using the
|
|
724
|
+
* descriptor which would create, rename, delete, modify the data or
|
|
725
|
+
* metadata of filesystem objects, or obtain another handle which
|
|
726
|
+
* would permit any of those, shall fail with `error-code::read-only` if
|
|
727
|
+
* they would otherwise succeed.
|
|
728
|
+
*
|
|
729
|
+
* This may only be set on directories.
|
|
730
|
+
*/
|
|
731
|
+
mutateDirectory?: boolean,
|
|
732
|
+
}
|
|
733
|
+
/**
|
|
734
|
+
* A descriptor is a reference to a filesystem object, which may be a file,
|
|
735
|
+
* directory, named pipe, special file, or other object on which filesystem
|
|
736
|
+
* calls may be made.
|
|
737
|
+
*
|
|
738
|
+
* This [represents a resource](https://github.com/WebAssembly/WASI/blob/main/docs/WitInWasi.md#Resources).
|
|
739
|
+
*/
|
|
740
|
+
export type Descriptor = number;
|
|
741
|
+
/**
|
|
742
|
+
* When setting a timestamp, this gives the value to set it to.
|
|
743
|
+
*/
|
|
167
744
|
export type NewTimestamp = NewTimestampNoChange | NewTimestampNow | NewTimestampTimestamp;
|
|
745
|
+
/**
|
|
746
|
+
* Leave the timestamp set to its previous value.
|
|
747
|
+
*/
|
|
168
748
|
export interface NewTimestampNoChange {
|
|
169
749
|
tag: 'no-change',
|
|
170
750
|
}
|
|
751
|
+
/**
|
|
752
|
+
* Set the timestamp to the current time of the system clock associated
|
|
753
|
+
* with the filesystem.
|
|
754
|
+
*/
|
|
171
755
|
export interface NewTimestampNow {
|
|
172
756
|
tag: 'now',
|
|
173
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* Set the timestamp to the given value.
|
|
760
|
+
*/
|
|
174
761
|
export interface NewTimestampTimestamp {
|
|
175
762
|
tag: 'timestamp',
|
|
176
763
|
val: Datetime,
|
|
177
764
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
765
|
+
/**
|
|
766
|
+
* File attributes.
|
|
767
|
+
*
|
|
768
|
+
* Note: This was called `filestat` in earlier versions of WASI.
|
|
769
|
+
*/
|
|
182
770
|
export interface DescriptorStat {
|
|
771
|
+
/**
|
|
772
|
+
* Device ID of device containing the file.
|
|
773
|
+
*/
|
|
183
774
|
device: Device,
|
|
775
|
+
/**
|
|
776
|
+
* File serial number.
|
|
777
|
+
*/
|
|
184
778
|
inode: Inode,
|
|
779
|
+
/**
|
|
780
|
+
* File type.
|
|
781
|
+
*/
|
|
185
782
|
type: DescriptorType,
|
|
783
|
+
/**
|
|
784
|
+
* Number of hard links to the file.
|
|
785
|
+
*/
|
|
186
786
|
linkCount: LinkCount,
|
|
787
|
+
/**
|
|
788
|
+
* For regular files, the file size in bytes. For symbolic links, the
|
|
789
|
+
* length in bytes of the pathname contained in the symbolic link.
|
|
790
|
+
*/
|
|
187
791
|
size: Filesize,
|
|
792
|
+
/**
|
|
793
|
+
* Last data access timestamp.
|
|
794
|
+
*/
|
|
188
795
|
dataAccessTimestamp: Datetime,
|
|
796
|
+
/**
|
|
797
|
+
* Last data modification timestamp.
|
|
798
|
+
*/
|
|
189
799
|
dataModificationTimestamp: Datetime,
|
|
800
|
+
/**
|
|
801
|
+
* Last file status change timestamp.
|
|
802
|
+
*/
|
|
190
803
|
statusChangeTimestamp: Datetime,
|
|
191
804
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
805
|
+
/**
|
|
806
|
+
* File or memory access pattern advisory information.
|
|
807
|
+
*
|
|
808
|
+
* # Variants
|
|
809
|
+
*
|
|
810
|
+
* ## `"normal"`
|
|
811
|
+
*
|
|
812
|
+
* The application has no advice to give on its behavior with respect
|
|
813
|
+
* to the specified data.
|
|
814
|
+
*
|
|
815
|
+
* ## `"sequential"`
|
|
816
|
+
*
|
|
817
|
+
* The application expects to access the specified data sequentially
|
|
818
|
+
* from lower offsets to higher offsets.
|
|
819
|
+
*
|
|
820
|
+
* ## `"random"`
|
|
821
|
+
*
|
|
822
|
+
* The application expects to access the specified data in a random
|
|
823
|
+
* order.
|
|
824
|
+
*
|
|
825
|
+
* ## `"will-need"`
|
|
826
|
+
*
|
|
827
|
+
* The application expects to access the specified data in the near
|
|
828
|
+
* future.
|
|
829
|
+
*
|
|
830
|
+
* ## `"dont-need"`
|
|
831
|
+
*
|
|
832
|
+
* The application expects that it will not access the specified data
|
|
833
|
+
* in the near future.
|
|
834
|
+
*
|
|
835
|
+
* ## `"no-reuse"`
|
|
836
|
+
*
|
|
837
|
+
* The application expects to access the specified data once and then
|
|
838
|
+
* not reuse it thereafter.
|
|
839
|
+
*/
|
|
840
|
+
export type Advice = 'normal' | 'sequential' | 'random' | 'will-need' | 'dont-need' | 'no-reuse';
|
|
841
|
+
/**
|
|
842
|
+
* Access type used by `access-at`.
|
|
843
|
+
*/
|
|
844
|
+
export type AccessType = AccessTypeAccess | AccessTypeExists;
|
|
845
|
+
/**
|
|
846
|
+
* Test for readability, writeability, or executability.
|
|
847
|
+
*/
|
|
848
|
+
export interface AccessTypeAccess {
|
|
849
|
+
tag: 'access',
|
|
850
|
+
val: Modes,
|
|
205
851
|
}
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
852
|
+
/**
|
|
853
|
+
* Test whether the path exists.
|
|
854
|
+
*/
|
|
855
|
+
export interface AccessTypeExists {
|
|
856
|
+
tag: 'exists',
|
|
210
857
|
}
|