The file system interface exposes the editor's built-in and contributed {@link FileSystemProvider file system providers}. It allows extensions to work with files from the local disk as well as files from remote places, like the remote extension host or ftp-servers.
Note that an instance of this interface is available as {@linkcode workspace.fs }.
The file system interface exposes the editor's built-in and contributed {@link FileSystemProvider file system providers}. It allows extensions to work with files from the local disk as well as files from remote places, like the remote extension host or ftp-servers. *Note* that an instance of this interface is available as {@linkcode workspace.fs }.
(copy file-system source target)
(copy file-system source target options)
Copy files or folders.
Parameters:
source
: Uri
- The existing file.target
: Uri
- The destination location.options
: { overwrite?: boolean | undefined; } | undefined
- Defines if existing files should be overwritten.Returns: Thenable<void>
Copy files or folders. **Parameters:** - `source`: `Uri` - The existing file. - `target`: `Uri` - The destination location. - `options`: `{ overwrite?: boolean | undefined; } | undefined` - Defines if existing files should be overwritten. **Returns:** `Thenable<void>`
(create-directory file-system uri)
Create a new directory (Note, that new files are created via write
-calls).
Note that missing directories are created automatically, e.g this call has
mkdirp
semantics.
Parameters:
uri
: Uri
- The uri of the new folder.Returns: Thenable<void>
Create a new directory (Note, that new files are created via `write`-calls). *Note* that missing directories are created automatically, e.g this call has `mkdirp` semantics. **Parameters:** - `uri`: `Uri` - The uri of the new folder. **Returns:** `Thenable<void>`
(delete file-system uri)
(delete file-system uri options)
Delete a file.
Parameters:
uri
: Uri
- The resource that is to be deleted.options
: { recursive?: boolean | undefined; useTrash?: boolean | undefined; } | undefined
- Defines if trash can should be used and if deletion of folders is recursiveReturns: Thenable<void>
Delete a file. **Parameters:** - `uri`: `Uri` - The resource that is to be deleted. - `options`: `{ recursive?: boolean | undefined; useTrash?: boolean | undefined; } | undefined` - Defines if trash can should be used and if deletion of folders is recursive **Returns:** `Thenable<void>`
(read-directory file-system uri)
Retrieve all entries of a {@link FileType.Directory directory}.
Parameters:
uri
: Uri
- The uri of the folder.Returns: Thenable<[string, FileType][]>
- An array of name/type-tuples or a thenable that resolves to such.
Retrieve all entries of a {@link FileType.Directory directory}. **Parameters:** - `uri`: `Uri` - The uri of the folder. **Returns:** `Thenable<[string, FileType][]>` - An array of name/type-tuples or a thenable that resolves to such.
(read-file file-system uri)
Read the entire contents of a file.
Parameters:
uri
: Uri
- The uri of the file.Returns: Thenable<Uint8Array>
- An array of bytes or a thenable that resolves to such.
Read the entire contents of a file. **Parameters:** - `uri`: `Uri` - The uri of the file. **Returns:** `Thenable<Uint8Array>` - An array of bytes or a thenable that resolves to such.
(rename file-system source target)
(rename file-system source target options)
Rename a file or folder.
Parameters:
source
: Uri
- The existing file.target
: Uri
- The new location.options
: { overwrite?: boolean | undefined; } | undefined
- Defines if existing files should be overwritten.Returns: Thenable<void>
Rename a file or folder. **Parameters:** - `source`: `Uri` - The existing file. - `target`: `Uri` - The new location. - `options`: `{ overwrite?: boolean | undefined; } | undefined` - Defines if existing files should be overwritten. **Returns:** `Thenable<void>`
(stat file-system uri)
Retrieve metadata about a file.
Parameters:
uri
: Uri
- The uri of the file to retrieve metadata about.Returns: Thenable<FileStat>
- The file metadata about the file.
Retrieve metadata about a file. **Parameters:** - `uri`: `Uri` - The uri of the file to retrieve metadata about. **Returns:** `Thenable<FileStat>` - The file metadata about the file.
(writable-file-system? file-system scheme)
Check if a given file system supports writing files.
Keep in mind that just because a file system supports writing, that does not mean that writes will always succeed. There may be permissions issues or other errors that prevent writing a file.
Parameters:
scheme
: string
- The scheme of the filesystem, for example file
or git
.Returns: boolean | undefined
- true
if the file system supports writing, false
if it does not
support writing (i.e. it is readonly), and undefined
if the editor does not
know about the filesystem.
Check if a given file system supports writing files. Keep in mind that just because a file system supports writing, that does not mean that writes will always succeed. There may be permissions issues or other errors that prevent writing a file. **Parameters:** - `scheme`: `string` - The scheme of the filesystem, for example `file` or `git`. **Returns:** `boolean | undefined` - `true` if the file system supports writing, `false` if it does not support writing (i.e. it is readonly), and `undefined` if the editor does not know about the filesystem.
(write-file file-system uri content)
Write data to a file, replacing its entire contents.
Parameters:
uri
: Uri
- The uri of the file.content
: Uint8Array
- The new content of the file.Returns: Thenable<void>
Write data to a file, replacing its entire contents. **Parameters:** - `uri`: `Uri` - The uri of the file. - `content`: `Uint8Array` - The new content of the file. **Returns:** `Thenable<void>`
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close