Skip to main content
版本:v1.0

rename

Zepp OS 小程序文件系统介绍请参考 文件系统

重命名小程序 /data 数据目录下文件。

类型

(oldPath: string, newPath: string) => result

参数

参数说明必填类型默认值
oldPath旧文件路径(相对路径)string-
newPath新文件路径(相对路径)string-

result

说明类型
操作结果,0 表示成功number

其余错误码请参考 文件系统 - 错误代码

代码示例

Page({
build() {
const result = hmFS.rename('path/to/old_file.txt', 'path/to/new_file.txt')
console.log(result)
}
})