# MosFiles

The MosFiles object provides functions used for working with files.&#x20;

{% hint style="warning" %}
Please note that calling any function of the *MosFiles* object will immediately put the script module into demo mode, if it is not licensed
{% endhint %}

### Methods <a href="#h.dlb4khgqvtip" id="h.dlb4khgqvtip"></a>

| **Name**                    | **Description**                                                                                                           |
| --------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| exists(filePath)            | Checks if the file specified in *filePath* exists. If the file exists on disk, returns *True*, otherwise returns *False*. |
| delete(filePath)            | Removes file specified in *filePath*.                                                                                     |
| getLastWriteTime(filePath)  | Returns the time of the last modification of the file in UTC specified in *filePath.*                                     |
| readText(filePath)          | Returns the content of the file specified in *filePath* as a string.                                                      |
| readLines(filePath)         | Returns the content of the file specified in *filePath* as a string array.                                                |
| writeText(filePath, text)   | Writes (overwrites) the string specified by the *text* argument into the file specified in *filePath*.                    |
| writeLines(filePath, lines) | Writes (overwrites) an array of strings specified by the *lines* argument into the file specified in *filePath*.          |


---

# 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.monokot.io/scripts/api/mosfiles.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.
