

# [`std::runtime::wasi::fs`](/silk/docs/std/runtime-wasi-fs/)

Source: [`std/runtime/wasi/fs.slk`](https://github.com/oro-computer/silk/blob/master/std/runtime/wasi/fs.slk)

This is the exact canonical documentation page for [`std::runtime::wasi::fs`](/silk/docs/std/runtime-wasi-fs/).

## Role

[`std::runtime::wasi::fs`](/silk/docs/std/runtime-wasi-fs/) is an implementation-facing runtime module in the shipped [`std/**`](https://github.com/oro-computer/silk/tree/master/std/**) tree.
It exists so higher-level stdlib surfaces can delegate platform or runtime-specific behavior without changing their public module names.

## Canonical Context

Use the following owning docs for the substantive API/design context for this module:

- [runtime](/silk/docs/std/runtime/)
- [fs](/silk/docs/std/fs/)

## Notes

- The shipped source for this module is [`std/runtime/wasi/fs.slk`](https://github.com/oro-computer/silk/blob/master/std/runtime/wasi/fs.slk).
- The canonical module name is [`std::runtime::wasi::fs`](/silk/docs/std/runtime-wasi-fs/).
- The shipped WASI backend now projects preview1 file metadata into the stable
 raw-stat layout used by [`std::runtime::fs::{stat,lstat,fstat}`](/silk/docs/std/runtime-fs/) and
 [`std::fs::Stats`](/silk/docs/std/fs/), with documented zero/fallback fields where preview1 lacks
 POSIX metadata.
- `fstat_size(fd)` reads the preview1 descriptor filestat directly without
 changing the descriptor offset. It returns `-1` and records a mapped errno
 when the syscall fails, the descriptor is invalid, allocation fails, or the
 unsigned WASI size cannot be represented as a Silk `i64`.
- It exposes the same borrowed directory-entry fill surface as the POSIX
 backend for [`std::fs::Dir.next_view()`](/silk/docs/std/fs/), backed by the per-directory WASI
 `fd_readdir` buffer.
- This page is intentionally implementation-oriented. Downstream users should usually start with the higher-level std module docs listed above unless they are working on the runtime layer itself.
