Working with files
List, read, write, download and delete files on a server.
List a directory
bashGET /v1/servers/:id/files?directory=/
tsconst res = await cloud.files.list(id, "/plugins");
The response mirrors the panel's file listing — an array of entries with name, is_file, size and modified_at.
Read a file
tsconst { content } = await cloud.files.read(id, "/server.properties");
Write a file
tsawait cloud.files.write(id, "/server.properties", "max-players=40\npvp=true\n");
Writing creates the file if it doesn't exist. The request body is capped at 5 MB.
Download
Get a short-lived signed URL served directly by the node:
tsconst { url } = await cloud.files.downloadUrl(id, "/world.zip");
Delete
tsawait cloud.files.delete(id, ["old-world", "crash.log"], "/");
Pass a root directory and an array of names within it to remove.