WasiOptions Class

Options of a WasiContext: what the module sees of its environment.

public sealed class WasiOptions

Constructors

NameDescription
WasiOptions()

WasiOptions()

WasiOptions.cs
public WasiOptions()

No documentation is available.

Properties

NameDescription
ArgumentsGets the command-line arguments of the module (args_get). By convention, the first argument is the name of the program. The default is no argument.
EnvironmentVariablesGets the environment variables of the module (environ_get). The default is no variable.
HttpClientGets the HTTP client of a component (wasi:http/client of WASI 0.3), or null for a component that cannot send requests: they fail with HTTP-request-denied. Use WasiHostHttpClient to send the requests over the network of the machine (with the rules of the requests the component can send), or WasiInMemoryHttpClient to give them to a handler of the process.
NetworkGets the network of a component (wasi:sockets of WASI 0.3), or null for a component without network: its sockets fail with access-denied. Use WasiHostNetwork for the network of the machine (with the rules of what the component can access), or WasiInMemoryNetwork for a network inside the process. The modules of WASI Preview 1 have no sockets.
PreopenedDirectoriesGets the directories that the module can access, as the file descriptors 3, 4, ... in this order. The module can access no file outside of these directories. The default is no directory.
RandomSourceGets the source of the random bytes of the module (random_get), or null to use RandomNumberGenerator.Fill.
StandardErrorGets the stream where the module writes its standard error (file descriptor 2), or null to discard the output.
StandardInputGets the stream that the module reads as its standard input (file descriptor 0), or null for an empty input.
StandardOutputGets the stream where the module writes its standard output (file descriptor 1), or null to discard the output.
TimeProviderGets the clock of the module: the realtime clock is TimeProvider.GetUtcNow, the monotonic clock is TimeProvider.GetTimestamp, and poll_oneoff waits with TimeProvider.CreateTimer. The default is TimeProvider.System.

Gets the command-line arguments of the module (args_get). By convention, the first argument is the name of the program. The default is no argument.

public IList<string> Arguments { get; init; }

Property value

IList<string>

EnvironmentVariables

WasiOptions.cs

Gets the environment variables of the module (environ_get). The default is no variable.

public IDictionary<string, string> EnvironmentVariables { get; init; }

HttpClient

WasiOptions.cs

Gets the HTTP client of a component (wasi:http/client of WASI 0.3), or null for a component that cannot send requests: they fail with HTTP-request-denied. Use WasiHostHttpClient to send the requests over the network of the machine (with the rules of the requests the component can send), or WasiInMemoryHttpClient to give them to a handler of the process.

public WasiHttpClient? HttpClient { get; init; }

Property value

WasiHttpClient?

Gets the network of a component (wasi:sockets of WASI 0.3), or null for a component without network: its sockets fail with access-denied. Use WasiHostNetwork for the network of the machine (with the rules of what the component can access), or WasiInMemoryNetwork for a network inside the process. The modules of WASI Preview 1 have no sockets.

public WasiNetwork? Network { get; init; }

Property value

WasiNetwork?

PreopenedDirectories

WasiOptions.cs

Gets the directories that the module can access, as the file descriptors 3, 4, ... in this order. The module can access no file outside of these directories. The default is no directory.

public IList<WasiPreopenedDirectory> PreopenedDirectories { get; init; }

RandomSource

WasiOptions.cs

Gets the source of the random bytes of the module (random_get), or null to use RandomNumberGenerator.Fill.

public WasiRandomSource? RandomSource { get; init; }

Property value

WasiRandomSource?

StandardError

WasiOptions.cs

Gets the stream where the module writes its standard error (file descriptor 2), or null to discard the output.

public Stream? StandardError { get; init; }

Property value

Stream?

StandardInput

WasiOptions.cs

Gets the stream that the module reads as its standard input (file descriptor 0), or null for an empty input.

public Stream? StandardInput { get; init; }

Property value

Stream?

StandardOutput

WasiOptions.cs

Gets the stream where the module writes its standard output (file descriptor 1), or null to discard the output.

public Stream? StandardOutput { get; init; }

Property value

Stream?

TimeProvider

WasiOptions.cs

Gets the clock of the module: the realtime clock is TimeProvider.GetUtcNow, the monotonic clock is TimeProvider.GetTimestamp, and poll_oneoff waits with TimeProvider.CreateTimer. The default is TimeProvider.System.

public TimeProvider TimeProvider { get; init; }

Property value

TimeProvider