File Manager API
Get File List
GET /api/files/list
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
target: string; // File(name or directory) Path
page: number;
page_size: number;
}
Response
{
"status": 200,
"data": {
"items": [
{
"name": "Genshin Impact",
"size": 0, // byte
"time": "Fri Jun 07 2024 08:53:34 GMT+0800 (中国标准时间)",
"mode": 777, // Linux file permission
"type": 0 // 0 = Folder, 1 = File
},
{
"name": "NEKO-MIMI SWEET HOUSEMATES Vol. 1",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "Poly Bridge",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "Wuthering Waves",
"size": 0,
"time": "Fri Jun 07 2024 04:32:58 GMT+0800 (中国标准时间)",
"mode": 666,
"type": 0
},
{
"name": "AngryBirdsSeasons",
"size": 0,
"time": "Thu Jun 06 2024 18:25:14 GMT+0800 (中国标准时间)",
"mode": 777,
"type": 0
},
{
"name": "secret base_君がくれたもの【Covered by Kotoha】.mp4",
"size": 13253857,
"time": "Thu Jun 06 2024 19:37:35 GMT+0800 (中国标准时间)",
"mode": 666,
"type": 1
}
],
"page": 0,
"pageSize": 100,
"total": 6,
"absolutePath": "\\"
},
"time": 1718594177859
}
Get File Contents
PUT /api/files/
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"target": "/eula.txt"
}
Response
{
"status": 200,
"data": "eula=false\n", // file content
"time": 1718594177859
}
Update File
PUT /api/files/
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"target": "/eula.txt",
"text": "eula=true\n" // file content
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Download File
POST /api/files/download
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
file_name: string; // Path + FileName, Example: /backup/world.zip
daemonId: string;
uuid: string; // Instance ID
}
Response
{
"status": 200,
"data": {
"password": "b2d8a6fa3bc8467ebd1563dc4f7179be1718010317889",
"addr": "localhost:24444" // Daemon Addr
},
"time": 1718594177859
}
Usage
GET http(s)://{{Daemon Addr}}/download/{{password}}/{{fileName}}
// For example:
GET http://localhost:24444/download/db8271f526...49468abd74/world.zip
Upload File
1. Get Upload Config
POST /api/files/upload
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
upload_dir: string;
daemonId: string;
uuid: string; // Instance ID
}
Response
{
"status": 200,
"data": {
"password": "b2d8a6fa3bc8467ebd1563dc4f7179be1718010317889",
"addr": "localhost:24444" // Daemon Addr
},
"time": 1718594177859
}
2. Upload File
POST http(s)://{{Daemon Address}}/upload/{{password}}
Request Headers
Content-Type: multipart/form-data
Request FormData
file: (Binary Data)
Response
OK
Copy
POST /api/files/copy
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"targets": [
[
"/server.jar", // source
"/cache/server.jar" // target
]
// ... more
]
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Move or Rename
PUT /api/files/move
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"targets": [
[
"/server.jar", // source
"/cache/server.jar" // target
],
// support rename
[
"/ops.json", // source
"/ops.txt" // target
]
// ... more
]
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Zip
POST /api/files/compress
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"type": 1,
"code": "utf-8", // only utf-8
"source": "/test.zip", // zip file path
"targets": [
"/world", // support folder
"/config.json",
"/server.jar"
]
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Unzip
POST /api/files/compress
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"type": 2,
"code": "utf-8", // format of the compressed file
// support: utf-8, gbk, big5
"source": "/test.zip", // zip file path
"targets": "/cache" // unzip to
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Delete
DELETE /api/files
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"targets": [
"/world", // support folder
"/cache/config.json",
"/server.jar"
]
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Touch File
POST /api/files/touch
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"target": "/test" // File name
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}
Create Folder
POST /api/files/mkdir
Query Param
The parameters here are URL Query parameters, which are presented in JSON format for better illustration.
{
daemonId: string;
uuid: string; // Instance ID
}
Request Body
{
"target": "/backup" // Folder name
}
Response
{
"status": 200,
"data": true,
"time": 1718594177859
}