Taro.saveFileToDisk(option)
保存文件系统的文件到用户磁盘,仅在 PC 端支持
支持情况: 
  
 
类型
(option: Option) => Promise<TaroGeneral.CallbackResult>
参数
| 参数 | 类型 | 
|---|---|
| option | Option | 
Option
| 参数 | 类型 | 必填 | 说明 | 
|---|---|---|---|
| filePath | string | 是 | 待保存文件路径 | 
| complete | (res: TaroGeneral.CallbackResult) => void | 否 | 接口调用结束的回调函数(调用成功、失败都会执行) | 
| fail | (result: TaroGeneral.CallbackResult) => void | 否 | 接口调用失败的回调函数 | 
| success | (result: TaroGeneral.CallbackResult) => void | 否 | 接口调用成功的回调函数 | 
示例代码
Taro.saveFileToDisk({
  filePath: `${Taro.env.USER_DATA_PATH}/hello.txt`,
  success(res) {
    console.log(res)
  },
  fail(res) {
    console.error(res)
  }
})