Write or overwrite file
write_fileWrite or overwrite a file in the server's workspace. With project_id, path is resolved inside that project's folder; without it, path is relative to the server workspace root. Use encoding:"base64" to write binary content (e.g. a generated .xlsx); plain text mode assumes UTF-8 and will corrupt binary bytes. One call carries up to 512 KB of content; write anything larger in pieces, or fetch it on the server with exec. Writing a file does not serve it: a project's URL is answered by a running app, so after writing the files call start_app (a changed server needs start_app again to pick the change up).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | File path, e.g. "public/index.html". Relative to the project folder when project_id is given, otherwise to the server workspace root. | |
| content | Yes | The file's full contents. Base64 encoded when encoding is base64. | |
| encoding | No | Optional, default "utf8". Set "base64" when content is base64-encoded binary data. | |
| server_id | Yes | The server's id, as returned by create_server or list_servers. | |
| project_id | No | Optional. Resolve path inside this project's workspace folder instead of the server workspace root. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | The path, as given. | |
| written | Yes | true once the file is written. | |
| encoding | No | How content was decoded. | |
| project_id | No | The project the path was resolved in. null for the server workspace root. |