FileSystemManager.saveFileSync

版本要求:
BaseKit≥2.2.3
支持平台:
iOSAndroid

方法签名
FileSystemManager.saveFileSync(params?: )

描述

将文件另存一份到目标路径中。

参数

参数类型必填说明
否参数对象

返回值

类型:Object↓
属性类型说明最低版本
savedFilePathstring【待废弃, 不建议使用】存储后的文件路径v2.4.3

示例代码

import { getFileSystemManager } from '@ray-js/ray'

// saveFile 把一个临时文件另存到目标路径;先在 Temp 写一个源文件。
const fm = await getFileSystemManager();

fm.writeFile({
  filePath: "thingfile://tmp/ttt_src.txt",
  data: "hello ttt",
  success: () => {
    fm.saveFile({
      tempFilePath: "thingfile://tmp/ttt_src.txt",
      filePath: "thingfile://usr/ttt_saved.txt",
      success: data => {
        console.log(data);
      },
      fail: error => {
        console.error(error);
      },
    });
  },
  fail: error => {
    console.error(error);
  },
});