Working with files

List, read, write, download and delete files on a server.

List a directory

bash
GET /v1/servers/:id/files?directory=/
ts
const 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

ts
const { content } = await cloud.files.read(id, "/server.properties");

Write a file

ts
await 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:

ts
const { url } = await cloud.files.downloadUrl(id, "/world.zip");

Delete

ts
await cloud.files.delete(id, ["old-world", "crash.log"], "/");

Pass a root directory and an array of names within it to remove.

Working with files | Enzonic Cloud API