write_file
Destructive
Write a file or folder to the world VFS (creating parents). A file the user attached or uploaded goes in with source (one file) or sources (a folder), from the file link the client supplies, so its bytes transfer directly. content is for text; content_b64 only for a small binary you generated in memory, never for a file that exists somewhere. local_path is not the way to send a file from the user's computer: it is read by a native engine on the engine's machine, inside its own transfer directory. Returns bytes written and any LSP diagnostics.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| as | No | Your own name, when you are one of several agents sharing one connection to this engine (the sub-agents one agent session runs share its connection, so without it the engine sees all of them as one caller). Pass the same name on every call you make. The engine then treats you as a caller of your own: your roster name is this name, and your play session, the play-shadow writes and refusals that say who wrote what, engine.modeOwner, your shell session and your notices are yours alone. Lowercase letters, digits, '-' and '_'. Leave it out when you are the only agent on your connection. | |
| path | Yes | ||
| quiet | No | Suppress automatic import callbacks while populating a folder; then run the importer explicitly. | |
| source | No | File reference to download into path; maximum 8 MiB. Use instead of inline content. | |
| content | No | UTF-8 text (or base64 when encoding=base64). | |
| durable | No | Write canonical world source while play is running. | |
| sources | No | Folder contents as file references with relative_path (or file_name). path names the destination folder. Writes in order; on failure reports completed files and the failed path. | |
| encoding | No | ||
| local_path | No | Read by the connected native Zero engine, on the engine's machine, and only inside its transfer directory: %LOCALAPPDATA%\OrigoZero\Transfers on Windows, ~/Library/Application Support/OrigoZero/Transfers on macOS, $XDG_DATA_HOME/OrigoZero/Transfers (default ~/.local/share/OrigoZero/Transfers) on Linux. Pass an absolute path inside that directory or a path relative to it, such as Blender/model.glb; something running on that machine must already have put the file there. This is not how to send a file from the user's computer or from yours. For a folder, `path` is the destination folder and every file keeps its path relative to the folder. At most 256 MiB and 10000 files per call; symlinks and junctions are rejected. A browser engine refuses local paths. Not combined with content, content_b64, encoding or source. | |
| awaitImport | No | When false, the write answers as soon as its bytes land, without waiting for an import they set off to settle, and the answer carries no `import`. For a run of writes that belong together (a model, then the buffer and textures it references), so no file of the run waits on an earlier one's import; `require("@builtin::assetTypes.importer.shared").writeOutcomes(paths, sinceFrame)` then answers where each one's bytes went. | |
| content_b64 | No | Base64 binary (overrides content), only for a small binary you generated in memory. A file the user attached goes in through `source`, never through here. |