Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface FileSystem

Hierarchy

  • FileSystem

Index

Methods

access

  • access(uri: string, mode?: number): Promise<boolean>
  • Tests a user's permissions for the file or directory specified by URI. The mode argument is 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.

    deprecated

    since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use FileService.access instead

    Parameters

    • uri: string
    • Optional mode: number

    Returns Promise<boolean>

copy

  • copy(sourceUri: string, targetUri: string, options?: { overwrite?: boolean; recursive?: boolean }): Promise<FileStat>
  • Copies the file to a path identified by the resource.

    The optional parameter overwrite can be set to replace an existing file at the location.

    deprecated

    since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use FileService.copy instead

    Parameters

    • sourceUri: string
    • targetUri: string
    • Optional options: { overwrite?: boolean; recursive?: boolean }
      • Optional overwrite?: boolean
      • Optional recursive?: boolean

    Returns Promise<FileStat>

createFile

  • createFile(uri: string, options?: { content?: string; encoding?: string }): Promise<FileStat>
  • Creates a new file with the given path. The returned promise will have the stat model object as a result.

    The optional parameter content can be used as value to fill into the new file.

    deprecated

    since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use FileService.create instead

    Parameters

    • uri: string
    • Optional options: { content?: string; encoding?: string }
      • Optional content?: string
      • Optional encoding?: string

    Returns Promise<FileStat>

createFolder

  • createFolder(uri: string): Promise<FileStat>

delete

exists

  • exists(uri: string): Promise<boolean>

getCurrentUserHome

  • getCurrentUserHome(): Promise<undefined | FileStat>

getDrives

  • getDrives(): Promise<string[]>

getEncoding

  • getEncoding(uri: string): Promise<string>

getFileStat

  • getFileStat(uri: string): Promise<undefined | FileStat>

getFsPath

  • getFsPath(uri: string): Promise<undefined | string>
  • Returns the path of the given file URI, specific to the backend's operating system. If the URI is not a file URI, undefined is returned.

    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.

    deprecated

    since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use FileService.fsPath instead

    Parameters

    • uri: string

    Returns Promise<undefined | string>

getRoots

guessEncoding

  • guessEncoding(uri: string): Promise<undefined | string>

move

resolveContent

  • resolveContent(uri: string, options?: { encoding?: string }): Promise<{ content: string; stat: FileStat }>

setContent

  • setContent(file: FileStat, content: string, options?: { encoding?: string }): Promise<FileStat>

touchFile

  • touchFile(uri: string): Promise<FileStat>

updateContent

  • updateContent(file: FileStat, contentChanges: TextDocumentContentChangeEvent[], options?: { encoding?: string; overwriteEncoding?: string }): Promise<FileStat>
  • Updates the content replacing its previous value.

    The optional parameter overwriteEncoding can be used to transform the encoding of a file.

    encoding overwriteEncoding behaviour
    1 undefined undefined read & write file in default encoding
    2 undefined read file in default encoding; write file in overwriteEncoding
    3 undefined read & write file in encoding
    4 read file in encoding; write file in overwriteEncoding
    deprecated

    since 1.4.0 - in order to support VS Code FS API (https://github.com/eclipse-theia/theia/pull/7908), use FileService.write instead

    Parameters

    • file: FileStat
    • contentChanges: TextDocumentContentChangeEvent[]
    • Optional options: { encoding?: string; overwriteEncoding?: string }
      • Optional encoding?: string
      • Optional overwriteEncoding?: string

    Returns Promise<FileStat>