Filesystem
Read, write, and manage files within your Sprite environment.
Read File
/v1/sprites/{name}/fs/read
Read file contents from the sprite filesystem. Returns raw file bytes.
Query Parameters
path*
string
Path to the file to read
workingDir*
string
Working directory for resolving relative paths
Response
application/jsonResponse Codes
Success
Not Found - Resource not found
Internal Server Error
Write File
/v1/sprites/{name}/fs/write
Write file contents to the sprite filesystem. Request body contains raw file bytes.
Query Parameters
path*
string
Path to the file to write
workingDir*
string
Working directory for resolving relative paths
mode
string
File permissions in octal (e.g., ‘0644’)
mkdir
bool
Create parent directories if they don’t exist
Response
application/jsonpath*
string
size*
number
mode*
string
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
List Directory
/v1/sprites/{name}/fs/list
List directory contents.
Query Parameters
path*
string
Path to the directory to list
workingDir*
string
Working directory for resolving relative paths
Response
application/jsonpath*
string
entries*
Entry[]
count*
number
Response Codes
Success
Not Found - Resource not found
Internal Server Error
Delete File or Directory
/v1/sprites/{name}/fs/delete
Delete a file or directory.
Response
application/jsondeleted*
string
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Rename File or Directory
/v1/sprites/{name}/fs/rename
Rename or move a file or directory.
Request Body
application/jsonsource*
string
dest*
string
workingDir*
string
asRoot*
boolean
Response
application/jsonsource*
string
dest*
string
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Copy File or Directory
/v1/sprites/{name}/fs/copy
Copy a file or directory.
Request Body
application/jsonsource*
string
dest*
string
workingDir*
string
recursive*
boolean
preserveAttrs*
boolean
asRoot*
boolean
Response
application/jsoncopied*
CopyResult[]
count*
number
totalBytes*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Change File Mode
/v1/sprites/{name}/fs/chmod
Change file or directory permissions.
Request Body
application/jsonpath*
string
workingDir*
string
mode*
string
recursive*
boolean
asRoot*
boolean
Response
application/jsonaffected*
ChmodResult[]
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Change File Owner
/v1/sprites/{name}/fs/chown
Change file or directory ownership.
Request Body
application/jsonpath*
string
workingDir*
string
uid*
interface{}
gid*
interface{}
recursive*
boolean
asRoot*
boolean
Response
application/jsonaffected*
ChownResult[]
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Watch Filesystem
/v1/sprites/{name}/fs/watch
Watch for filesystem changes via WebSocket.
JSON Messages
WatchMessage
Client → Server
type*
String
paths
[String]
recursive
boolean
workingDir
String
path
String
event
String
timestamp
String
size
integer
isDir
boolean
message
String
WatchMessage
Server → Client
type*
String
paths
[String]
recursive
boolean
workingDir
String
path
String
event
String
timestamp
String
size
integer
isDir
boolean
message
String
Binary Protocol
In non-PTY mode, binary messages are prefixed with a stream identifier byte. In PTY mode, binary data is sent raw without prefixes.
| Stream ID | Name | Direction | Description |
|---|---|---|---|
| 0 | stdin | client → server | Standard input data |
| 1 | stdout | server → client | Standard output data |
| 2 | stderr | server → client | Standard error data |
| 3 | exit | server → client | Exit code (payload is exit code as byte) |
| 4 | stdin_eof | client → server | End of stdin stream |
Response Codes
Switching Protocols - WebSocket connection established
Bad Request - Invalid WebSocket upgrade or missing parameters
Not Found - Resource not found