FileSystemManager.mkdir

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

方法签名
FileSystemManager.mkdir(params: )
SDK 最低版本
iOSThingSmartBaseKitBizBundle
≥ 5.2.1
Androidcom.thingclips.smart:thingsmart-bizbundle-basekit
≥ 5.2.0

描述

创建目录,需要文件读写权限

参数

属性类型必填默认值说明SDK 最低版本
dirPathstring是-创建的目录路径 (本地路径)—
recursiveboolean否false是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。 如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录, 以此类推直至创建 a/b/c 目录下的 d 目录。 默认值:false—
complete() => void否-接口调用结束的回调函数(调用成功、失败都会执行)—
success() => void否-接口调用成功的回调函数—
fail(params: Object) => void否-接口调用失败的回调函数—
fail 回调参数
属性类型说明
errorMsgstring错误信息
errorCodestring | number错误码
错误扩展

返回值

无

示例代码

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

const fm = await getFileSystemManager();

fm.mkdir({
  dirPath: "thingfile://usr/ttt_demo_dir",
  recursive: true,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});