FilesystemService

Writes content to a file, creating it if it doesn't exist. If the path is a symbolic link, the target file is written to (symlink is followed).

Authorization: Only the creator of the parent SandboxEngine is allowed to call this method.

post/v1/{name}/filesystem:writeFile

Request

Path parameters

namestring required

Required. The name of the sandbox engine. Format: workspaces/{workspace}/sandboxEngines/{sandbox_engine}

Request body

pathstring required

Required. The path where the file should be written. All paths are rooted at the sandbox filesystem root. Must start with a forward slash (e.g., "/app.js", "/workspace/data.csv"). If the file exists, it will be overwritten unless overwrite=false. If the file doesn't exist, it will be created with 0644 permissions (rw-r--r--), unless a custom mode is specified. Parent directories must exist unless create_parent_directories is true.

contentstring byte required

Required. The raw content to write to the file as bytes. For text files, provide UTF-8 encoded text. For binary files, provide raw binary data.

createParentDirectoriesboolean

Optional. If true, creates parent directories if they don't exist. If false or unspecified, the write will fail if parent directories don't exist.

overwriteboolean nullable

Optional. Controls overwrite behavior for existing files. If true or unspecified, overwrites the file if it already exists. If explicitly set to false, the operation will fail if the file already exists. This allows atomic create-new-only semantics (similar to O_CREAT|O_EXCL).

modestring

Optional. Unix file mode and permission bits in octal notation. The format follows standard Unix permissions represented as a string. Examples: "0644" (rw-r--r--), "0755" (rwxr-xr-x), "0600" (rw-------). If not specified, defaults to "0644" for new files. When overwriting an existing file, the mode is only applied if this field is explicitly set.

Response

A successful response.

Changes

No recorded changes to this operation across all 1 revision of this API.