Skip to content

TFile

Defined in: obsidian.d.ts:4125

Extends

Constructors

new TFile()

new TFile(): TFile

Returns

TFile

Inherited from

TAbstractFile.constructor

Properties

basename

basename: string

Defined in: obsidian.d.ts:4133


deleted

deleted: boolean

Defined in: src/obsidian/augmentations/TAbstractFile.d.ts:8

Whether the file or folder is being deleted

Inherited from

TAbstractFile.deleted


extension

extension: string

Defined in: obsidian.d.ts:4137


name

name: string

Defined in: obsidian.d.ts:3999

Inherited from

TAbstractFile.name


parent

parent: null | TFolder

Defined in: obsidian.d.ts:4003

Inherited from

TAbstractFile.parent


path

path: string

Defined in: obsidian.d.ts:3995

Inherited from

TAbstractFile.path


saving

saving: boolean

Defined in: src/obsidian/augmentations/TFile.d.ts:8

Whether the file is being saved


stat

stat: FileStats

Defined in: obsidian.d.ts:4129


vault

vault: Vault

Defined in: obsidian.d.ts:3991

Inherited from

TAbstractFile.vault

Methods

cache()

cache(content): void

Defined in: src/obsidian/augmentations/TFile.d.ts:15

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

Parameters

content

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

null | string

Returns

void


getNewPathAfterRename()

getNewPathAfterRename(newName): string

Defined in: src/obsidian/augmentations/TAbstractFile.d.ts:15

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

Defined in: src/obsidian/augmentations/TFile.d.ts:25

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

Defined in: src/obsidian/augmentations/TFile.d.ts:29

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

Returns

unknown