# Filesystem

### Functions <a href="#functions" id="functions"></a>

#### read <a href="#read" id="read"></a>

fs.read("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |

**Returns:**

| ​[Value](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| data                                                                                 | string                                                                                  |

#### read\_stream <a href="#read_stream" id="read_stream"></a>

fs.read\_stream("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |

**Returns:**

| ​[Value](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| data                                                                                 | table of char                                                                           |

#### write <a href="#write" id="write"></a>

fs.write("some\_file.txt", "data")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |
| data                                                                                     | string                                                                                  | data to write to file                                                                      |

​

#### write\_stream <a href="#write_stream" id="write_stream"></a>

fs.write\_stream("some\_file.txt", {"a", "b", "c"})

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |
| data                                                                                     | table of char                                                                           | data in bytes to write to file                                                             |

#### remove <a href="#remove" id="remove"></a>

fs.remove("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |

#### exists <a href="#exists" id="exists"></a>

fs.exists("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file or directory                                                                  |

**Returns:**

| ​[Value](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| true if file exists                                                                  | boolean                                                                                 |

#### is\_file <a href="#is_file" id="is_file"></a>

fs.is\_file("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to file                                                                               |

**Returns:**

| ​[Value](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| true if path leads to a file                                                         | boolean                                                                                 |

#### is\_dir <a href="#is_dir" id="is_dir"></a>

fs.is\_dir("some\_file.txt")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to directory                                                                          |

**Returns:**

| ​[Value](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------- |
| true if path leads to a directory                                                    | boolean                                                                                 |

#### create\_dir <a href="#create_dir" id="create_dir"></a>

fs.create\_dir("folder/some\_directory")

| ​[Parameter](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Datatype](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ | ​[Description](https://jewls.gitbook.io/fatality-api/documentation/namespaces/filesystem)​ |
| ---------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------ |
| path                                                                                     | string                                                                                  | path to directory                                                                          |


---

# 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://fecality-api.gitbook.io/docs/documentation/namespaces/filesystem.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.
