Filesystem
Read, write, and manage files within your Sprite environment.
Filesystem
Read File
Read file contents from the sprite filesystem. Returns raw file bytes.
/sprites/{name}/fs/read
Query Parameters
path*
string
Path to the file to read
workingDir*
string
Working directory for resolving relative paths
Response Body
application/jsonResponse Codes
Success
Not Found - Resource not found
Internal Server Error
Filesystem
Write File
Write file contents to the sprite filesystem. Request body contains raw file bytes.
/sprites/{name}/fs/write
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 Body
application/jsonpath*
string
size*
number
mode*
string
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
List Directory
List directory contents.
/sprites/{name}/fs/list
Query Parameters
path*
string
Path to the directory to list
workingDir*
string
Working directory for resolving relative paths
Response Body
application/jsonpath*
string
entries*
Entry[]
count*
number
Response Codes
Success
Not Found - Resource not found
Internal Server Error
Filesystem
Delete File or Directory
Delete a file or directory.
/sprites/{name}/fs/delete
Response Body
application/jsondeleted*
string
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
Rename File or Directory
Rename or move a file or directory.
/sprites/{name}/fs/rename
Request Body
application/jsonsource*
string
dest*
string
workingDir*
string
asRoot*
boolean
Response Body
application/jsonsource*
string
dest*
string
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
Copy File or Directory
Copy a file or directory.
/sprites/{name}/fs/copy
Request Body
application/jsonsource*
string
dest*
string
workingDir*
string
recursive*
boolean
preserveAttrs*
boolean
asRoot*
boolean
Response Body
application/jsoncopied*
CopyResult[]
count*
number
totalBytes*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
Change File Mode
Change file or directory permissions.
/sprites/{name}/fs/chmod
Request Body
application/jsonpath*
string
workingDir*
string
mode*
string
recursive*
boolean
asRoot*
boolean
Response Body
application/jsonaffected*
ChmodResult[]
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
Change File Owner
Change file or directory ownership.
/sprites/{name}/fs/chown
Request Body
application/jsonpath*
string
workingDir*
string
uid*
interface{}
gid*
interface{}
recursive*
boolean
asRoot*
boolean
Response Body
application/jsonaffected*
ChownResult[]
count*
number
Response Codes
Success
Bad Request - Invalid request body
Not Found - Resource not found
Internal Server Error
Filesystem
Watch Filesystem
Watch for filesystem changes via WebSocket.
/sprites/{name}/fs/watch
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