An event that is emitted when file operation is failed. This event is triggered by user gestures.
An event that is emitted when operation is finished. This event is triggered by user gestures and programmatically.
An event that is emitted when file operation is finished. This event is triggered by user gestures.
See FileServiceContribution.registerProviders
.
An event that is emitted when file operation is being performed. This event is triggered by user gestures.
An event that is emitted when files are changed on the disk.
Tests a user's permissions for the given resource.
URI
of the resource which should be tested.
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 bitwise OR
of two or more values (e.g. FileAccess.Constants.W_OK | FileAccess.Constants.R_OK).
If mode
is not defined, FileAccess.Constants.F_OK
will be used instead.
Try to activate the registered provider for the given scheme
The uri scheme for which the responsible provider should be activated.
A promise of the activated file system provider. Only resolves if a provider is available for this scheme, gets rejected otherwise.
Tests if the service (i.e. any of its registered FileSystemProviders) can handle the given resource.
URI
of the resource to test.
true
if the resource can be handled, false
otherwise.
Tests if the given resource exists in the filesystem.
URI
of the resource which should be tested.
A promise that resolves to true
if the resource exists.
Resolves the fs path of the given URI.
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.
If you need to display human readable simple or long names then use LabelProvider
instead.
URI
of the resource that should be resolved.
A promise of the resolved fs path.
Tests if the service (i.e the FileSystemProvider registered for the given uri scheme) provides the given capability.
URI
of the resource to test.
The required capability.
true
if the resource can be handled and the required capability can be provided.
List the schemes and capabilities for registered file system providers
Dirty write prevention: if the file on disk has been changed and does not match our expected mtime and etag, we bail out to prevent dirty writing.
First, we check for a mtime that is in the future before we do more checks. The assumption is that only the mtime is an indicator for a file that has changed on disk.
Second, if the mtime has advanced, we compare the size of the file on disk with our previous one using the etag() function. Relying only on the mtime check has proven to produce false positives due to file system weirdness (especially around remote file systems). As such, the check for size is a weaker check because it can return a false negative if the file has changed but to the same length. This is a compromise we take to avoid having to produce checksums of the file content for comparison which would be much slower to compute.
Registers a new FileSystemProvider for the given scheme.
The (uri) scheme for which the provider should be registered.
The file system provider that should be registered.
A Disposable
that can be invoked to unregister the given provider.
Try to resolve file information and metadata for the given resource.
URI
of the resource that should be resolved.
Options to customize the resolvement process.
A promise that resolves if the resource could be successfully resolved.
Try to resolve file information and metadata for all given resource.
An array of all the resources (and corresponding resolvement options) that should be resolved.
A promise of all resolved resources. The promise is not rejected if any of the given resources cannot be resolved.
Instead this is reflected with the success
flag of the corresponding ResolveFileResult.
Converts to an underlying fs provider resource format.
For example converting user-storage
resources to file
resources under a user home:
user-storage:/user/settings.json => file://home/.theia/settings.json
The FileService is the common facade responsible for all interactions with file systems. It manages all registered FileSystemProviders and forwards calls to the responsible FileSystemProvider, determined by the scheme. For additional documentation regarding the provided functions see also FileSystemProvider.