FileSystemProvider

The filesystem provider defines what the editor needs to read, write, discover, and to manage files and folders. It allows extensions to serve files from remote places, like ftp-servers, and to seamlessly integrate those into the editor.

  • Note 1: The filesystem provider API works with uris and assumes hierarchical paths, e.g. foo:/my/path is a child of foo:/my/ and a parent of foo:/my/path/deeper.

  • Note 2: There is an activation event onFileSystem:<scheme> that fires when a file or folder is being accessed.

  • Note 3: The word 'file' is often used to denote all kinds of files, e.g. folders, symbolic links, and regular files.

Online Documentation

Types

Link copied to clipboard
interface CopyOptions
Link copied to clipboard
interface DeleteOptions
Link copied to clipboard
interface RenameOptions
Link copied to clipboard
interface WatchOptions
Link copied to clipboard

Properties

Link copied to clipboard
abstract var copy: (source: Uri, destination: Uri, options: FileSystemProvider.CopyOptions) -> PromiseLike<Void?>??

Copy files or folders. Implementing this function is optional but it will speedup the copy operation.

Link copied to clipboard

An event to signal that a resource has been created, changed, or deleted. This event should fire for resources that are being watched by clients of this provider.

Functions

Link copied to clipboard
abstract fun createDirectory(uri: Uri): PromiseLike<Void?>?

Create a new directory (Note, that new files are created via write-calls).

Link copied to clipboard

Delete a file.

Link copied to clipboard

Retrieve all entries of a directory.

Link copied to clipboard
abstract fun readFile(uri: Uri): PromiseResult<Uint8Array<*>>

Read the entire contents of a file.

Link copied to clipboard
abstract fun rename(oldUri: Uri, newUri: Uri, options: FileSystemProvider.RenameOptions): PromiseLike<Void?>?

Rename a file or folder.

Link copied to clipboard
abstract fun stat(uri: Uri): PromiseResult<FileStat>

Retrieve metadata about a file.

Link copied to clipboard
abstract fun watch(uri: Uri, options: FileSystemProvider.WatchOptions): Disposable

Subscribes to file change events in the file or folder denoted by uri. For folders, the option recursive indicates whether subfolders, sub-subfolders, etc. should be watched for file changes as well. With recursive: false, only changes to the files that are direct children of the folder should trigger an event.

Link copied to clipboard
abstract fun writeFile(uri: Uri, content: Uint8Array<*>, options: FileSystemProvider.WriteFileOptions): PromiseLike<Void?>?

Write data to a file, replacing its entire contents.