Skip to content

TExternalFile

Official

Represents a file that is outside the Vault. Can be used with the vault API just like any other file. Do not create these manually.

Import:

import { TExternalFile } from 'obsidian';

Signature:

export class TExternalFile extends TFile

Extends: TFile

Constructor

new TExternalFile(vault: Vault, path: string)

Constructor.

To get the constructor instance, use getTFileConstructor from obsidian-typings/implementations.

Properties

PropertyTypeDescription
basenamestringThe basename of the file (name without extension).
(Inherited from TFile)
extensionstringThe extension of the file.
(Inherited from TFile)
namestringThe name of the file (with extension).
(Inherited from TFile)
savingbooleanWhether the file is being saved.
(Inherited from TFile)
statFileStatsThe stats of the file.
(Inherited from TFile)

Methods

MethodReturnsDescription
cache(content)voidCaches file's content, that can be retrieved via await app.vault.cachedRead(file).
(Inherited from TFile)
getRealPath()stringReturns the physical path in the filesystem.
getShortName()stringGets 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.
(Inherited from TFile)
updateCacheLimit()unknownRemoves the file from the cache if its content length greater than app.vault.cacheLimit.
(Inherited from TFile)