Copies the file to a path identified by the resource.
The optional parameter overwrite can be set to replace an existing file at the location.
Creates a new file with the given path. The returned promise will have the stat model object as a result.
The optional parameter content can be used as value to fill into the new file.
Creates a new folder with the given path. The returned promise will have the stat model object as a result.
Deletes the provided file. The optional moveToTrash parameter allows to move the file to trash.
Finds out if a file identified by the resource exists.
Returns a promise that resolves to a file stat representing the current user's home directory.
Resolves to an array of URIs pointing to the available drives on the filesystem.
Returns the encoding of the given file resource.
Returns the file stat for the given URI.
If the uri points to a folder it will contain one level of unresolved children.
undefined
if a file for the given URI does not exist.
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.
Return list of available roots.
Guess encoding of a given file based on its content.
Moves the file to a new path identified by the resource.
The optional parameter overwrite can be set to replace an existing file at the location.
missing | file | empty dir | dir | |
---|---|---|---|---|
missing | x | x | x | x |
file | ✓ | x | x | x |
empty dir | ✓ | x | x | overwrite |
dir | ✓ | x | overwrite | overwrite |
Resolve the contents of a file identified by the resource.
Creates a new empty file if the given path does not exist and otherwise will set the mtime and atime of the file to the current date.
Updates the content replacing its previous value.
The optional parameter overwriteEncoding
can be used to transform the encoding of a file.
encoding | overwriteEncoding | behaviour | |
---|---|---|---|
1 | undefined | undefined | read & write file in default encoding |
2 | undefined | ✓ | read file in default encoding; write file in overwriteEncoding |
3 | ✓ | undefined | read & write file in encoding |
4 | ✓ | ✓ | read file in encoding ; write file in overwriteEncoding |
Tests a user's permissions for the file or directory specified by URI. The mode argument is 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 bitwiseOR
of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK). Ifmode
is not defined,FileAccess.Constants.F_OK
will be used instead.since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use
FileService.access
instead