Skip to main content

FileSystem

interface

The file system interface exposes the editor's built-in and contributed 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 workspace.fs.

interface FileSystem

Import

import { FileSystem } from '@modular/sdk';

Members9

copy()
(source: Uri, target: Uri, options?: { /** * Overwrite the file if it does exist. */ overwrite?: boolean; }) => Thenable<void>

Copy files or folders.

createDirectory()
(uri: Uri) => 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.

delete()
(uri: Uri, options?: { /** * Delete the content recursively if a folder is denoted. */ recursive?: boolean; /** * Use the os's trashcan instead of permanently deleting files whenever possible. */ useTrash?: boolean; }) => Thenable<void>

Delete a file.

isWritableFileSystem()
(scheme: string) => boolean | undefined

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.

readDirectory()
(uri: Uri) => Thenable<[string, FileType][]>

Retrieve all entries of a directory.

readFile()
(uri: Uri) => Thenable<Uint8Array>

Read the entire contents of a file.

rename()
(source: Uri, target: Uri, options?: { /** * Overwrite the file if it does exist. */ overwrite?: boolean; }) => Thenable<void>

Rename a file or folder.

stat()
(uri: Uri) => Thenable<FileStat>

Retrieve metadata about a file.

writeFile()
(uri: Uri, content: Uint8Array) => Thenable<void>

Write data to a file, replacing its entire contents.