Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface IDartFileSystem

An interface enables interacting with the file system. There are only some APIs because we do not want that module packages control all files.


class MainScreen extends ModuleScreen {

readonly dartfs: IDartFileSystem;

constructor(props: ModuleScreenProps) {
super(props);
this.dartfs = System.getSystemLibrary(System.DART_FILE_SYSTEM, this) as IDartFileSystem;
}
}
api-version

1

user

Hierarchy

  • IDartFileSystem

Index

Methods

  • exists(target: string): Promise<boolean>
  • Whether the given path exists by checking with the file system asynchronously. Module package can check only files which are located in the module package path.

      isExist(relativeFilePath: string) {
    const rootFilePath = dartfs.getModuleRootDirPath(this);
    if (dartfs.exists(path.join(rootFilePath, relativeFilePath))) {
    // do someting
    }
    }
    api-version

    1

    user

    Parameters

    • target: string

      A target file path.

    Returns Promise<boolean>

    Return Fulfills with the result of whether given path exist.

  • getDiskSpace(path: string): Promise<null | { free: number; total: number }>
  • Get disk's free size and total size information.

    api-version

    1

    user

    Parameters

    • path: string

      A directory path to check.

    Returns Promise<null | { free: number; total: number }>

    Return Fulfills with free size and total size in bytes.

  • readFile(context: ModuleContext, target: string): Promise<string>
  • Asynchronously reads the entire contents of a file. Module package can read only files which are located in the module package path.

      readConfigFile() {
    const rootFilePath = dartfs.getModuleRootDirPath(this);
    const processTemplate = dartfs.readFile(this.moduleContext, path.join(rootFilePath, "process_template.drl"));
    ...
    }
    api-version

    1

    user

    Parameters

    • context: ModuleContext

      A caller's context.

    • target: string

      A target file path.

    Returns Promise<string>

    Return Fulfills with the contents of the file.

  • run(packageName: string, queryString: string): Promise<boolean>
  • Executes a SQL query.

    api-version

    3

    user
    example
    
    

    Parameters

    • packageName: string
    • queryString: string

      The SQL query string to be executed.

    Returns Promise<boolean>

    A Promise that resolves with the query result.

Generated using TypeDoc