FileSystemManager.saveFileSync

Requires:
BaseKit≥2.2.3
Platforms:
iOSAndroid

Method signature
FileSystemManager.saveFileSync(params?: )
Minimum SDK versions
iOSThingSmartBaseKitBizBundle
≥ 5.2.1
Androidcom.thingclips.smart:thingsmart-bizbundle-basekit
≥ 5.2.0

Description

Save a copy of the file to the target path.

Parameters

ParameterTypeRequiredDescription
NoParameter object

Return Value

Type: Object↓
PropertyTypeDescriptionSinceMinimum SDK versions
savedFilePathstring[Deprecated, not recommended] Path of the stored filev2.4.3—

Examples

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

// saveFile saves a temporary file to the target path; write a source file to Temp first.
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);
  },
});