FileSystemManager.rmdir

Requires:
BaseKit≥2.4.3
Platforms:
iOSAndroid

Method signature
FileSystemManager.rmdir(params: )
Minimum SDK versions
iOSThingSmartBaseKitBizBundle
≥ 5.2.1
Androidcom.thingclips.smart:thingsmart-bizbundle-basekit
≥ 5.2.0

Description

Delete a directory; requires file read/write permissions

Parameters

PropertyTypeRequiredDescriptionMinimum SDK versions
dirPathstringYesPath of the directory to delete (local path)—
recursivebooleanNoWhether to delete the directory recursively. If true, deletes the directory and all its subdirectories and files. Default: false—
complete() => voidNoCompletion callback (executed on both success and failure)—
success() => voidNoCallback on successful API call—
fail(params: Object) => voidNoFailure callback—
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

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

// Create a directory first to ensure there's one to remove.
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);
  },
});