# File System Library (fs)

Functions for working with the file system. Requires the "system" feature to automatically be added, otherwise, remove this library to further sandbox your environment.

## fs.read(path: str) -> blob

If available, will read a file from a path into a binary blob.

```rust
const bytes = fs.read("src/lib.rs");
```

## fs.read\_string(path: str) -> str

If available, will read a file from a path into a string.

```rust
const content = fs.read_string("src/lib.rs");
```

## fs.write(path: str, content: str | blob) -> void

If available, will write content into a file at the given path. Will throw an error if the directory doesn't exist and will overwrite the file if it already exists.

```rust
fs.write("src/text.txt", "testing");
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stof.dev/libraries/file-system-library-fs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
