Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FileSystem

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.

Hierarchy

  • FileSystem

Index

Methods(9)

stat

  • 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.

readDirectory

createDirectory

  • 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>

readFile

  • 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.

writeFile

  • writeFile(uri: Uri, content: Uint8Array): 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>

delete

  • delete(uri: Uri, options?: { recursive?: boolean; useTrash?: boolean }): Thenable<void>
  • Delete a file.

    Parameters

    • uri: Uri

      The resource that is to be deleted.

    • Optional options: { recursive?: boolean; useTrash?: boolean }

      Defines if trash can should be used and if deletion of folders is recursive

      • Optional recursive?: boolean

        Delete the content recursively if a folder is denoted.

      • Optional useTrash?: boolean

        Use the os's trashcan instead of permanently deleting files whenever possible.

    Returns Thenable<void>

rename

  • rename(source: Uri, target: Uri, options?: { overwrite?: boolean }): Thenable<void>
  • Rename a file or folder.

    Parameters

    • source: Uri

      The existing file.

    • target: Uri

      The new location.

    • Optional options: { overwrite?: boolean }

      Defines if existing files should be overwritten.

      • Optional overwrite?: boolean

        Overwrite the file if it does exist.

    Returns Thenable<void>

copy

  • copy(source: Uri, target: Uri, options?: { overwrite?: boolean }): Thenable<void>
  • Copy files or folders.

    Parameters

    • source: Uri

      The existing file.

    • target: Uri

      The destination location.

    • Optional options: { overwrite?: boolean }

      Defines if existing files should be overwritten.

      • Optional overwrite?: boolean

        Overwrite the file if it does exist.

    Returns Thenable<void>

isWritableFileSystem

  • isWritableFileSystem(scheme: string): undefined | boolean
  • 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 undefined | boolean

    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.

Generated by TypeDoc. Maintained by 紫升

Links: 搜外友链, 69中文网