Filesystem
The Filesystem library provides functions for reading, writing, and managing files on the local system.
You cannot access files outside the workspace folder for security reasons, unless an explicit symlink is created within the workspace folder.
Overview
These functions allow you to:
- Read and write files
- Create and delete files and folders
- Check if files and folders exist
- List directory contents
Available Functions
| Function | Description |
|---|---|
appendfile | Append data to a file |
delfile | Delete a file |
delfolder | Delete a folder |
dofile | Load and execute a Lua file |
getcustomasset | Get a content URL for a local file |
isfile | Check if a path is a file |
isfolder | Check if a path is a folder |
listfiles | List files in a folder |
loadfile | Load a Lua file as a function |
makefolder | Create a folder |
readfile | Read contents of a file |
writefile | Write data to a file |
Workspace Folder
All file operations are relative to volt's workspace folder. This is a sandboxed directory that prevents access to sensitive system files.
-- These are relative to the workspace folder
writefile("myfile.txt", "Hello") -- workspace/myfile.txt
writefile("subfolder/file.txt", "Hi") -- workspace/subfolder/file.txt