跳到主要内容
版本:latest

SaveFileBody

保存文本内容到指定文件,用于在线编辑代码或配置文件。

  • 路由POST /files
  • actionSaveFileBody

输入参数

参数名称必选类型描述
actionString固定值 SaveFileBody
pathString文件绝对路径
dataString要写入的文件内容
encodingString文件编码:utf-8 / ascii / ansi / GBK / BIG5

重要encoding 参数必须传入,否则会报 FILE_SAVE_ERR 错误。

输出参数

参数名称类型描述
statusBooleantrue 保存成功
msgString文件已保存!
historysArray历史版本 ID 列表
st_mtimeString修改时间戳

示例

请求

POST /files HTTP/1.1
Host: 192.168.168.213:8888
Content-Type: application/x-www-form-urlencoded

action=SaveFileBody&path=/tmp/test.txt&data=hello world&encoding=utf-8

响应

{"status": true, "msg": "文件已保存!", "historys": ["1779514192"], "st_mtime": "1779514192"}

相关接口