WebUI X Documentation
    Preparing search index...

    Defines a static-like interface for synchronous file system operations. This interface provides a direct way to interact with the file system from a sandboxed environment, like a WebView. All operations are synchronous and will block execution until they complete. It serves as a factory for creating FileSystemInstance objects and for performing operations on paths directly.

    interface FileSystem {
        canExecuteSync(path: string): boolean;
        copyFileSync(path: string, dest: string): void;
        copyFileSync(path: string, dest: string, overwrite: boolean): void;
        createNewFileSync(path: string): boolean;
        existsSync(path: string): boolean;
        isBlockSync(path: string): boolean;
        isCharacterSync(path: string): boolean;
        isDirectorySync(path: string): boolean;
        isFileSync(path: string): boolean;
        isHiddenSync(path: string): boolean;
        isNamedPipeSync(path: string): boolean;
        isSocketSync(path: string): boolean;
        isSymlinkSync(path: string): boolean;
        listSync(path: string): null | string;
        listSync(path: string, delimiter: string): null | string;
        mkdirsSync(path: string): boolean;
        mkdirSync(path: string): boolean;
        newInstance(path: string): null | FileSystemInstance;
        readTextSync(path: string): null | string;
        renameSync(path: string, newPath: string): boolean;
        rmSync(path: string): boolean;
        sizeSync(path: string): null | number;
        statSync(path: string): null | number;
        writeTextSync(path: string, text: string): null | void;
    }
    Index

    Methods

    • Checks if the application has execute permissions for the given path.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the file is executable, false otherwise.

    • Copies a file from a source path to a destination path.

      Parameters

      • path: string

        The source file path.

      • dest: string

        The destination file path.

      Returns void

    • Parameters

      • path: string
      • dest: string
      • overwrite: boolean

      Returns void

    • Creates a new, empty file at the specified path.

      Parameters

      • path: string

        The path where the new file should be created.

      Returns boolean

      true if the file was created, false if it already exists or an error occurred.

    • Checks if a file or directory exists at the given path.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path exists, false otherwise.

    • Checks if the given path points to a block device.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a block device, false otherwise.

    • Checks if the given path points to a character device.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a character device, false otherwise.

    • Checks if the given path points to a directory.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a directory, false otherwise.

    • Checks if the given path points to a regular file.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a file, false otherwise.

    • Checks if the file or directory at the given path is hidden.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is hidden, false otherwise.

    • Checks if the given path points to a named pipe (FIFO).

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a named pipe, false otherwise.

    • Checks if the given path points to a socket.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a socket, false otherwise.

    • Checks if the given path points to a symbolic link.

      Parameters

      • path: string

        The path to check.

      Returns boolean

      true if the path is a symbolic link, false otherwise.

    • Lists the files and directories in a given path.

      Parameters

      • path: string

        The path of the directory to list.

      Returns null | string

      A string containing the names of the items in the directory, or null if the path is not a directory or an error occurs.

    • Parameters

      • path: string
      • delimiter: string

      Returns null | string

    • Creates a directory, including any necessary but non-existent parent directories.

      Parameters

      • path: string

        The path of the directory to create.

      Returns boolean

      true if the directories were created, false otherwise.

    • Creates a new directory. Fails if the parent directory does not exist.

      Parameters

      • path: string

        The path of the directory to create.

      Returns boolean

      true if the directory was created, false otherwise.

    • Creates a new FileSystemInstance for a given path. This instance can then be used to perform operations on that specific file or directory.

      Parameters

      • path: string

        The absolute path to the file or directory.

      Returns null | FileSystemInstance

      A new instance representing the path, or null if the path is invalid or inaccessible.

    • Reads the entire content of a file at a given path as a UTF-8 string.

      Parameters

      • path: string

        The path to the file to read.

      Returns null | string

      The content of the file as a string, or null if the file does not exist or cannot be read.

    • Renames or moves a file or directory.

      Parameters

      • path: string

        The original path.

      • newPath: string

        The new path.

      Returns boolean

      true if the operation was successful, false otherwise.

    • Removes a file or an empty directory at the given path.

      Parameters

      • path: string

        The path to remove.

      Returns boolean

      true if the removal was successful, false otherwise.

    • Returns the size of the file at the given path in bytes.

      Parameters

      • path: string

        The path to the file.

      Returns null | number

      The size of the file in bytes, or null if it doesn't exist or is a directory.

    • Retrieves file status information, typically the last modification time as a Unix timestamp.

      Parameters

      • path: string

        The path to the file or directory.

      Returns null | number

      The last modification time (e.g., in milliseconds since epoch), or null if the path does not exist.

    • Writes a string to a file at a given path, overwriting the file if it exists.

      Parameters

      • path: string

        The path to the file to write to.

      • text: string

        The string content to write to the file.

      Returns null | void

      Returns null if the operation fails.