MemFileProvider
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) |
number |
|
roots (readonly) |
Uri[] |
|
scheme (readonly) |
"inmemory" |
createDirectory()
Signature
createDirectory(uri: Uri): voidParameters
uri(Uri) - The uri of the new directory.
Returns
void
delete()
Signature
delete(uri: Uri): voidParameters
uri(Uri) - The resource that is to be deleted.
Returns
void
hasCapability()
Signature
hasCapability(capability: FileSystemProviderCapabilities): booleanParameters
capability(FileSystemProviderCapabilities)
Returns
boolean
move()
Signature
move(source: Uri, destination: Uri, options: object): voidParameters
source(Uri) - The existing file.destination(Uri) - The destination location.options(object) - Defines if existing files should be copied.
Returns
void
read()
Signature
read(uri: Uri): Promise<string>Parameters
uri(Uri) - The uri of the file.
Returns
Promise<string>
readDirectory()
Signature
readDirectory(uri: Uri): Promise<IFile[]>Parameters
uri(Uri) - The uri of the directory.
Returns
Promise<IFile[]>
rename()
Signature
rename(uri: Uri, name: string): voidParameters
uri(Uri) - The existing file.name(string) - The new location.
Returns
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): Promise<void>Parameters
file(File) - The file object to upload.destination(Uri) - The uri where the file should be uploaded.
Returns
Promise<void>
write()
Signature
write(uri: Uri, content: string, update?: boolean): voidParameters
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