Theia API Documentation v1.65.0
    Preparing search index...

    Interface FileSystemProviderWithAccessCapability

    Subtype of FileSystemProvider that ensures that the optional functions needed for providers, that should be able access files, are implemented.

    interface FileSystemProviderWithAccessCapability {
        capabilities: FileSystemProviderCapabilities;
        onDidChangeCapabilities: Event<void>;
        onDidChangeFile: Event<readonly FileChange[]>;
        onFileWatchError: Event<void>;
        access(resource: URI, mode?: number): Promise<void>;
        close?(fd: number): Promise<void>;
        copy?(from: URI, to: URI, opts: FileOverwriteOptions): Promise<void>;
        delete(resource: URI, opts: FileDeleteOptions): Promise<void>;
        fsPath(resource: URI): Promise<string>;
        mkdir(resource: URI): Promise<void>;
        open?(resource: URI, opts: FileOpenOptions): Promise<number>;
        read?(
            fd: number,
            pos: number,
            data: Uint8Array,
            offset: number,
            length: number,
        ): Promise<number>;
        readdir(resource: URI): Promise<[string, FileType][]>;
        readFile?(resource: URI): Promise<Uint8Array>;
        readFileStream?(
            resource: URI,
            opts: FileReadStreamOptions,
            token: CancellationToken,
        ): ReadableStreamEvents<Uint8Array>;
        rename(from: URI, to: URI, opts: FileOverwriteOptions): Promise<void>;
        stat(resource: URI): Promise<Stat>;
        updateFile?(
            resource: URI,
            changes: TextDocumentContentChangeEvent[],
            opts: FileUpdateOptions,
        ): Promise<FileUpdateResult>;
        watch(resource: URI, opts: WatchOptions): Disposable;
        write?(
            fd: number,
            pos: number,
            data: Uint8Array,
            offset: number,
            length: number,
        ): Promise<number>;
        writeFile?(
            resource: URI,
            content: Uint8Array,
            opts: FileWriteOptions,
        ): Promise<void>;
    }

    Hierarchy (View Summary)

    Index

    Properties

    The FileSystemProviderCapabilities for this provider.

    onDidChangeCapabilities: Event<void>
    • Event that is fired if the capabilities of this provider have changed.
    onDidChangeFile: Event<readonly FileChange[]>

    Event that is fired if a (watched) file in the filesystem of this provider has changed.

    onFileWatchError: Event<void>

    Event that is fired if an error occurred when watching files in the filesystem of this provider.

    Methods

    • Tests a user's permissions for the file or directory specified by URI.

      Parameters

      • resource: URI

        The URI of the file that should be tested.

      • Optionalmode: number

        An optional integer that specifies the accessibility checks to be performed. Check FileAccess.Constants for possible values of mode. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK). If mode is not defined, FileAccess.Constants.F_OK will be used instead.

      Returns Promise<void>

      A promise that resolves if the user has the required permissions, should be rejected otherwise.

    • Returns the path of the given file URI, specific to the backend's operating system. If the URI is not a file URI, undefined is returned.

      USE WITH CAUTION: You should always prefer URIs to paths if possible, as they are portable and platform independent. Paths should only be used in cases you directly interact with the OS, e.g. when running a command on the shell.

      Parameters

      • resource: URI

        URI of the resource to derive the path from.

      Returns Promise<string>

      A promise of the corresponding file system path.