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)
}
})