writeFile() method allows you to create or overwrite files inside your sandbox’s isolated filesystem. It supports both text and binary content, making it flexible enough for handling scripts, configuration files, and assets like images or compiled binaries.
All file paths must begin with either the tilde (~) shortcut or the absolute sandbox path /home/damner/code.
writeFile(options)
Description:
Writes a file to the sandbox filesystem. Supports both text and binary content.
Parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
| path | string | Yes | File path (must start with ~ or /home/damner/code) |
| content | string | ArrayBuffer | Yes | File content (text string or binary data) |
Promise<void> - Resolves when write is complete
Example:
