File APIs

saveFile

Save file in a local position.

Overview

my.saveFile saves a file in a local position. The total capacity of local file size is limited to 10 MB.

Sample Code

my.chooseImage({
  success: (res) => {
    my.saveFile({
      apFilePath: res.apFilePaths[0],
      success: (res) => {
        console.log(JSON.stringify(res));
      },
    });
  },
});

Parameters

Object type with the following attributes:

PropertyTypeRequiredDescription
apFilePathStringYesFile path.
successFunctionNoCallback function upon call success.
failFunctionNoCallback function upon call failure.
completeFunctionNoCallback function upon call completion (to be executed upon either call success or failure).

Success Callback Function

The incoming parameter is of the Object type with the following attributes:

PropertyTypeDescription
apFilePathStringFile save path.

Usage Notes

  • Total capacity of local file storage is limited to 10 MB
  • The saved file path is returned in the success callback
  • Use this API to persist temporary files (like those from my.chooseImage)