Expand description
WASI filesystem is a filesystem API primarily intended to let users run WASI programs that access their files on their existing filesystems, without significant overhead.
It is intended to be roughly portable between Unix-family platforms and Windows, though it does not hide many of the major differences.
Paths are passed as interface-type string
s, meaning they must consist of
a sequence of Unicode Scalar Values (USVs). Some filesystems may contain
paths which are not accessible by this API.
The directory separator in WASI is always the forward-slash (/
).
All paths in WASI are relative paths, and are interpreted relative to a
descriptor
referring to a base directory. If a path
argument to any WASI
function starts with /
, or if any step of resolving a path
, including
..
and symbolic link steps, reaches a directory outside of the base
directory, or reaches a symlink to an absolute or rooted path in the
underlying filesystem, the function fails with error-code::not-permitted
.
For more information about WASI path resolution and sandboxing, see WASI filesystem path resolution.
Structs§
- Descriptor
- A descriptor is a reference to a filesystem object, which may be a file, directory, named pipe, special file, or other object on which filesystem calls may be made.
- Descriptor
Flags - Descriptor flags.
- Descriptor
Stat - File attributes.
- Directory
Entry - A directory entry.
- Directory
Entry Stream - A stream of directory entries.
- Metadata
Hash Value - A 128-bit hash value, split into parts because wasm doesn’t have a 128-bit integer type.
- Open
Flags - Open flags used by
open-at
. - Path
Flags - Flags determining the method of how paths are resolved.
Enums§
- Advice
- File or memory access pattern advisory information.
- Descriptor
Type - The type of a filesystem object referenced by a descriptor.
- Error
Code - Error codes returned by functions, similar to
errno
in POSIX. Not all of these error codes are returned by the functions provided by this API; some are used in higher-level library layers, and others are provided merely for alignment with POSIX. - NewTimestamp
- When setting a timestamp, this gives the value to set it to.
Functions§
- filesystem_
error_ code - Attempts to extract a filesystem-related
error-code
from the streamerror
provided.
Type Aliases§
- Datetime
- Error
- Filesize
- File size or length of a region within a file.
- Input
Stream - Link
Count - Number of hard links to an inode.
- Output
Stream