FileSystemProvider
class
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/pathis a child offoo:/my/and a parent offoo:/my/path/deeper. - Note 2: The word 'file' is often used to denote all kinds of files, e.g. folders, regular files.
Properties
| Name | Type | Description |
|---|---|---|
capabilities (readonly) |
FileSystemProviderCapabilities |
|
scheme (readonly) |
string |
createDirectory()
Signature
createDirectory(uri: Uri): void | Promise<void>Parameters
uri(Uri) - The uri of the new directory.
Returns
void | Promise<void>
delete()
Signature
delete(uri: Uri): void | Promise<void>Parameters
uri(Uri) - The resource that is to be deleted.
Returns
void | Promise<void>
hasCapability()
Signature
hasCapability(capability: FileSystemProviderCapabilities): booleanParameters
capability(FileSystemProviderCapabilities)
Returns
boolean
move()
Signature
move(source: Uri, destination: Uri, options: object): void | Promise<void>Parameters
source(Uri) - The existing file.destination(Uri) - The destination location.options(object) - Defines if existing files should be copied.
Returns
void | Promise<void>
read()
Signature
read(uri: Uri): string | Promise<string>Parameters
uri(Uri) - The uri of the file.
Returns
string | Promise<string>
readDirectory()
Signature
readDirectory(uri: Uri): IFile[] | Promise<IFile[]>Parameters
uri(Uri) - The uri of the directory.
Returns
IFile[] | Promise<IFile[]>
rename()
Signature
rename(uri: Uri, name: string): void | Promise<void>Parameters
uri(Uri) - The existing file.name(string) - The new location.
Returns
void | Promise<void>
search()
Signature
search(uri: Uri, form: SearchForm): Promise<SearchResult<Uri>[]>Parameters
uri(Uri)form(SearchForm)
Returns
Promise<SearchResult<Uri>[]>
stat()
Signature
stat(uri: Uri): Promise<IFile>Parameters
uri(Uri) - The uri of the file.
Returns
Promise<IFile>
upload()
Signature
upload(file: File, destination: Uri): void | Promise<void>Parameters
file(File) - The file object to upload.destination(Uri) - The uri where the file should be uploaded.
Returns
void | Promise<void>
write()
Signature
write(uri: Uri, content: string, update: boolean): void | Promise<void>Parameters
uri(Uri) - The uri of the file.content(string) - The new content of the file.update(boolean) - Updates the content of the file instead of created a new file.
Returns
void | Promise<void>