> ## Documentation Index
> Fetch the complete documentation index at: https://lua.nlcrack.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# File

> File system access rooted at C:\neverwin\scripts\data. Requires insecure mode.

## Functions

| Function | Returns | Description |
| - | - | - |
| `file.read(name)` | `string?`, `error?` | Read file contents |
| `file.write(name, text)` | `bool` | Write to file (creates or overwrites) |
| `file.append(name, text)` | `bool` | Append to file |
| `file.exists(name)` | `bool` | Check if file exists |
| `file.remove(name)` | `bool` | Delete a file |
| `file.list([folder])` | `table` | List directory contents |

All paths are relative to the data root. Directory traversal outside the root is blocked.

## Example

```lua theme={null} theme={null}
file.write('log.txt', utils.date() .. ' script loaded\n')

local data = file.read('settings.json')
if data then
    local cfg = json.decode(data)
    print(cfg.name)
end
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.