> For the complete documentation index, see [llms.txt](https://dibs.gitbook.io/vortex-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://dibs.gitbook.io/vortex-docs/standard-modules/i-o.md).

# I/O

The 'io' module provides functionality to interact with files

### Function Signatures

{% code overflow="wrap" %}

```go
// File open modes
const OpenMode = {
    app: 1,
    read: 8,
    write: 16,
    trunc: 32,
}

// Open a file with specified file path and open mode.
const open = (filePath: String, openMode: Number = OpenMode.read) => Pointer

// Close a file with given file handle.
const close = (fileHandle: Pointer) => None

// Read from a file with given file handle.
const read = (fileHandle: Pointer) => String

// Write content to a file with given file handle.
const write = (fileHandle: Pointer, content: String) => None

// Read input from standard input.
const input = () => String

// Read content from a file with specified file path. Automatically handles closing the file.
const readf = (filePath: String) => String

// Write content to a file with specified file path, truncating existing content. Automatically handles closing the file.
const writef = (filePath: String, content: String) => String

// Append content to a file with specified file path. Automatically handles closing the file.
const appendf = (filePath: String, content: String) => String

```

{% endcode %}
