Interface FileSystemProvider

A FileSystemProvider provides the capabilities to read, write, discover, and to manage files and folders of the underlying (potentially virtual) file system. FileSystemProviders can be used to serve files from both the local disk as well as remote locations like ftp-servers, REST-services etc. A FileSystemProvider is registered for a certain scheme and can handle all resources whose uri does conform to that scheme.

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

Hierarchy (view full)

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

  • Delete the given resource.

    Parameters

    • resource: URI

      The URI of the resource to delete.

    • opts: FileDeleteOptions

      Options to define if files should be deleted recursively and if the trash should be used.

    Returns Promise<void>

  • Watch the given resource and react to changes by firing the FileSystemProvider#onDidChangeFile event.

    Parameters

    • resource: URI

      URI of the resource to be watched.

    • opts: WatchOptions

      Options to define if the resource should be watched recursively and to provide a set of resources that should be excluded from watching.

    Returns Disposable

    A Disposable that can be invoked to stop watching the resource.