File 文件系统
获取文件列表
GET/file/v1/list
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
响应
名称 | 类型 | 描述 |
---|---|---|
path | string | 绝对路径 |
title | string | 目标路径所属目录的名称 |
name | string | 文件或目录名称 |
type | string<'folder' | 'file'> | 文件类型 |
updated_at | string | 最后修改时间 |
created_at | string | 创建时间 |
children | object[] | 成员,即下级内容(注:成员名称字段均为 name ) |
示例
{
"path": "/arcadia",
"title": "arcadia",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00",
"children": [
{
"path": "/arcadia/config",
"name": "config",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
},
{
"path": "/arcadia/log",
"name": "log",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
},
{
"path": "/arcadia/raw",
"name": "raw",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
},
{
"path": "/arcadia/repo",
"name": "repo",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
},
{
"path": "/arcadia/scripts",
"name": "scripts",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
},
{
"path": "/arcadia/src",
"name": "src",
"type": "folder",
"updated_at": "2024-01-01 00:00:00",
"created_at": "2024-01-01 00:00:00"
}
]
}
获取文件内容
GET/file/v1/content
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
响应
示例
function template() {\n console.log(\"Hello World\");\n}
保存文件内容
POST/file/v1/content
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
content | string | 是 | 文件内容 |
删除
POST/file/v1/delete
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | string[] | 是 | 绝对路径 |
支持批量
查询属性
GET/file/v1/info
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
响应
名称 | 类型 | 描述 |
---|---|---|
type | string<'folder' | 'file'> | 文件类型 |
name | string | 名称 |
parent_path | string | 存储位置路径 |
mode | string | 权限(3位数字) |
size | number | 大小(单位字节) |
display_size | string | 格式化大小(带单位) |
modified_time | string | 内容最后一次被修改的时间 |
accessed_time | string | 最后一次被访问的时间 |
created_time | string | 创建时间 |
changed_time | string | 属性(如权限或链接)最后一次被更改的时间 |
示例
{
"type": "file",
"name": "example",
"parent_path": "/arcadia/log",
"mode": "644",
"size": 2048,
"display_size": "2.00 KB",
"modified_time": "2024-01-01 00:00:00",
"accessed_time": "2024-01-01 00:00:00",
"created_time": "2024-01-01 00:00:00",
"changed_time": "2024-01-01 00:00:00"
}
创建
POST/file/v1/create
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 存放路径 |
name | string | 是 | 名称 |
type | string<'folder' | 'file'> | 是 | 文件类型 |
移动
POST/file/v1/move
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径(原) |
newPath | string | 是 | 绝对路径(新) |
重命名
POST/file/v1/rename
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
name | string | 是 | 新的名称 |
下载
GET/file/v1/download
请求
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
下载目录时会压缩成
zip
文件上传
POST/file/v1/upload
名称 | 类型 | 必填 | 描述 |
---|---|---|---|
path | string | 是 | 绝对路径 |
接口特殊,使用 query 即 URLParams
传参,暂不支持上传目录