Defined in: src/wasi_ctx/mod.rs
This class defines a WASI execution context.
Feature gate: wasi
Used to handle standard output.
Depending on the config, data can be a String
or PackedByteArray
.
Feature gate: wasi
Used to handle standard error.
Depending on the config, data can be a String
or PackedByteArray
.
If set to true
, prevents any instance from writing to filesystem.
If set to true
, pass standard output and standard error to Godot
instead of emitting signal.
Sets environment variable.
Gets environment variable.
Deletes environment variable.
Mounts path to Webassembly. Host and guest path must be global path, not Godot specific paths. If guest path is not set, it is set the same as host path.
Gets all mount points and their source directory.
Unmounts path.
Checks if file exists. Possible return values:
- 0 : File does not exist
- 1 : Is a file
- 2 : Is a directory
- 3 : Is a symlink
Create new file. Returns true
if succeed.
Create new directory. Returns true
if succeed.
Create new symlink. Returns true
if succeed.
Delete file. Returns true
if succeed.
Returns all filenames in directory.
Returns file stats, like size
, ctime
, mtime
, and atime
.
Set file mtime
and atime
with the value in dictionary.
You can omit values and it'll be filled with current time.
Reads symlink target.
Reads file content. Set length to 0 to read the entire file.
Writes file content.
Accepts String
and all Pool*
data type, except PoolStringArray
.
File will be appended with zeros if needed.
Returns true
if succeed.
Reads file content as structured data. Similar to WasmInstance.read_struct
.
bool file_write_struct(String path, String format, Array arr, [int offset, bool truncate, bool follow_symlink])
Writes file content as structured data. Similar to WasmInstance.write_struct
.