> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: files
description: File I/O — read, write, and list files
icon: file-text
---

The `files` namespace provides file I/O utilities for reading, writing, and managing files.

## create\_folder

```lua
files.create_folder(path: string)
```

> Creates a new folder at the specified path.

<Schema title="Parameters">
  <SchemaField name="path" type="string" required>
    New folder path
  </SchemaField>
</Schema>

## read

```lua
files.read(path: string): any
```

> Returns contents of the specified file.

<Schema title="Parameters">
  <SchemaField name="path" type="string" required>
    Path to the file
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="contents" type="any">
    The contents of the specified file.
  </SchemaField>
</Schema>

## write

```lua
files.write(path: string, contents: string[, is_binary: boolean]): boolean
```

> Replaces contents of the specified file. Returns `false` on failure.

<Schema title="Parameters">
  <SchemaField name="path" type="string" required>
    Path to the file
  </SchemaField>

  <SchemaField name="contents" type="any" required>
    Contents the file should be set to
  </SchemaField>

  <SchemaField name="is_binary" type="boolean">
    Is contents a binary
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="success" type="boolean">
    `false` on failure.
  </SchemaField>
</Schema>

## get\_crc32

```lua
files.get_crc32(path: string): number
```

> Returns the crc32 checksum of the file.

<Schema title="Parameters">
  <SchemaField name="path" type="string" required>
    Path to the file
  </SchemaField>
</Schema>

<Schema title="Returns">
  <SchemaField name="checksum" type="number">
    The crc32 checksum of the file.
  </SchemaField>
</Schema>
