Skip to content

TFile

Extends

Constructors

new TFile()

new TFile(): TFile

Returns

TFile

Inherited from

TAbstractFile.constructor

Properties

basename

basename: string


deleted

deleted: boolean

Whether the file or folder is being deleted

Inherited from

TAbstractFile.deleted


extension

extension: string


name

name: string

Inherited from

TAbstractFile.name


parent

parent: null | TFolder

Inherited from

TAbstractFile.parent


path

path: string

Inherited from

TAbstractFile.path


saving

saving: boolean

Whether the file is being saved


stat

stat: FileStats


vault

vault: Vault

Inherited from

TAbstractFile.vault

Methods

cache()

cache(content): void

Caches file’s content, that can be retrieved via await app.vault.cachedRead(file).

Parameters

content: null | string

The content to cache. If null, the cache is cleared.

Returns

void


getNewPathAfterRename()

getNewPathAfterRename(newName): string

Gets the path after renaming the file or folder.

Parameters

newName: string

The new name of the file or folder.

Returns

string

The new path of the file or folder.

Inherited from

TAbstractFile.getNewPathAfterRename


getShortName()

getShortName(): string

Gets the short name of the file.

For a/b/c.md, it returns c.

For a/b/c.any-other-extension it returns c.any-other-extension.

Returns

string

The short name of the file.


updateCacheLimit()

updateCacheLimit(): unknown

Removes the file from the cache if its content length greater than app.vault.cacheLimit.

Returns

unknown