createFile
创建文件
import { MFileManager } from "@yl/super-jssdk"
MFileManager.createFile(optional)
参数说明
| 参数 |
类型 |
必填 |
作用 |
| optional |
Object |
是 |
必填参数 |
optional
| 参数 |
类型 |
必填 |
作用 |
| path |
string |
是 |
文件的绝对路径,如果父路径不存在,会自动创建 |
| content |
string |
否 |
创建文件时写进去的文本内容 |
返回说明
| 参数 |
类型 |
作用 |
| resolve() |
Function |
执行成功 |
| reject(err) |
Function |
接口出错,err为详细错误信息,是一个json对象,例如:{"errCode":-1,"errMsg":"出错啦"} |
代码示例
MFileManager.createFile({
path: 'file:///storage/emulated/0/Android/data/com.mysoft.smartengineertest/images/workbench-configs/cjap-icon'
}).then(() => {
console.log('文件创建成功');
}).catch(err => {
console.error(err);
})