Skip to content

Virtual file system tree.

root: string

Root of the workspace. All paths are relative to this.

changePermissions(filePath, mode): void

Changes permissions of a file.

NameTypeDescription
filePathstringA path to a file.
modeModeThe permission to be granted on the file, given as a string (e.g 755) or octal integer (e.g 0o755). See https://nodejs.org/api/fs.html#fs_file_modes.

void


children(dirPath): string[]

Returns the list of children of a folder.

NameType
dirPathstring

string[]


delete(filePath): void

Delete the file.

NameType
filePathstring

void


exists(filePath): boolean

Check if a file exists.

NameType
filePathstring

boolean


isFile(filePath): boolean

Check if this is a file or not.

NameType
filePathstring

boolean


listChanges(): FileChange[]

Returns the list of currently recorded changes.

FileChange[]


read(filePath): Buffer<ArrayBufferLike>

Read the contents of a file.

NameTypeDescription
filePathstringA path to a file.

Buffer<ArrayBufferLike>

read(filePath, encoding): string

Read the contents of a file as string.

NameTypeDescription
filePathstringA path to a file.
encodingBufferEncodingthe encoding for the result

string


rename(from, to): void

Rename the file or the folder.

NameType
fromstring
tostring

void


write(filePath, content, options?): void

Update the contents of a file or create a new file.

NameType
filePathstring
contentstring | Buffer<ArrayBufferLike>
options?TreeWriteOptions

void