FileSystemManager.rmdir

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

方法签名
FileSystemManager.rmdir(params: )

描述

删除目录,需要文件读写权限

参数

属性类型必填说明
dirPathstring是要删除的目录路径 (本地路径)
recursiveboolean否是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。 默认值: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: () => {
    fm.rmdir({
      dirPath: "thingfile://usr/ttt_demo_dir",
      recursive: true,
      success: data => {
        console.log(data);
      },
      fail: error => {
        console.error(error);
      },
    });
  },
  fail: error => {
    console.error(error);
  },
});