Skip to main content

Listing files in a directory

api.GetApplicationFiles(appID, path) returns the entries of a directory as a []squarecloud.FileInfo. An empty path lists the application root.

Reading a file

api.ReadApplicationFile(appID, path) returns a squarecloud.FileContent with the file bytes.
The API returns the content as a Node.js-style Buffer object ({"type": "Buffer", "data": [...]}). The SDK decodes it for you — content.Data is a plain []byte (the ByteArray type), ready to use.

Creating or overwriting a file

api.PutApplicationFile(appID, path, content) writes content at path, creating the file if it does not exist or overwriting it if it does. It returns a squarecloud.FileWritten.
The content is sent to the API as a UTF-8 string — binary file uploads are not supported yet. To ship binary files, use a commit instead.

Moving or renaming a file

api.MoveApplicationFile(appID, path, to) moves or renames a file.

Deleting a file or directory

Deleting a directory removes everything inside it. There is no way to recover deleted files unless you have a snapshot.