Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FileSystemProvider

Hierarchy

  • FileSystemProvider

Index

Properties

onDidChangeFile: Event<FileChangeEvent[]>

An event to signal that a resource has been created, changed, or deleted. This event should fire for resources that are being watched by clients of this provider.

Note: It is important that the metadata of the file that changed provides an updated mtime that advanced from the previous value in the stat and a correct size value. Otherwise there may be optimizations in place that will not show the change in an editor for example.

Methods

  • close(fd: number): void | Thenable<void>
  • copy(source: Uri, destination: Uri, options: { overwrite: boolean }): void | Thenable<void>
  • Copy files or folders. Implementing this function is optional but it will speedup the copy operation.

    throws

    FileNotFound when source doesn't exist.

    throws

    FileNotFound when parent of destination doesn't exist, e.g. no mkdirp-logic required.

    throws

    FileExists when destination exists and when the overwrite option is not true.

    throws

    NoPermissions when permissions aren't sufficient.

    Parameters

    • source: Uri

      The existing file.

    • destination: Uri

      The destination location.

    • options: { overwrite: boolean }

      Defines if existing files should be overwritten.

      • overwrite: boolean

    Returns void | Thenable<void>

  • delete(uri: Uri, options: { recursive: boolean }): void | Thenable<void>
  • open(resource: Uri, options: { create: boolean }): number | Thenable<number>
  • read(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>
  • rename(oldUri: Uri, newUri: Uri, options: { overwrite: boolean }): void | Thenable<void>
  • Rename a file or folder.

    throws

    FileNotFound when oldUri doesn't exist.

    throws

    FileNotFound when parent of newUri doesn't exist, e.g. no mkdirp-logic required.

    throws

    FileExists when newUri exists and when the overwrite option is not true.

    throws

    NoPermissions when permissions aren't sufficient.

    Parameters

    • oldUri: Uri

      The existing file.

    • newUri: Uri

      The new location.

    • options: { overwrite: boolean }

      Defines if existing files should be overwritten.

      • overwrite: boolean

    Returns void | Thenable<void>

  • Retrieve metadata about a file.

    Note that the metadata for symbolic links should be the metadata of the file they refer to. Still, the SymbolicLink-type must be used in addition to the actual type, e.g. FileType.SymbolicLink | FileType.Directory.

    throws

    FileNotFound when uri doesn't exist.

    Parameters

    • uri: Uri

      The uri of the file to retrieve metadata about.

    Returns FileStat | Thenable<FileStat>

    The file metadata about the file.

  • watch(uri: Uri, options: { excludes: string[]; recursive: boolean }): Disposable
  • Subscribe to events in the file or folder denoted by uri.

    The editor will call this function for files and folders. In the latter case, the options differ from defaults, e.g. what files/folders to exclude from watching and if subfolders, sub-subfolder, etc. should be watched (recursive).

    Parameters

    • uri: Uri

      The uri of the file to be watched.

    • options: { excludes: string[]; recursive: boolean }

      Configures the watch.

      • excludes: string[]
      • recursive: boolean

    Returns Disposable

    A disposable that tells the provider to stop watching the uri.

  • write(fd: number, pos: number, data: Uint8Array, offset: number, length: number): number | Thenable<number>
  • writeFile(uri: Uri, content: Uint8Array, options: { create: boolean; overwrite: boolean }): void | Thenable<void>
  • Write data to a file, replacing its entire contents.

    throws

    FileNotFound when uri doesn't exist and create is not set.

    throws

    FileNotFound when the parent of uri doesn't exist and create is set, e.g. no mkdirp-logic required.

    throws

    FileExists when uri already exists, create is set but overwrite is not set.

    throws

    NoPermissions when permissions aren't sufficient.

    Parameters

    • uri: Uri

      The uri of the file.

    • content: Uint8Array

      The new content of the file.

    • options: { create: boolean; overwrite: boolean }

      Defines if missing files should or must be created.

      • create: boolean
      • overwrite: boolean

    Returns void | Thenable<void>