Vault
Extends Events
#
Constructorconstructor();
#
Properties#
adapteradapter: DataAdapter
#
configDirconfigDir: string
Gets the path to the config folder.
This value is typically .obsidian
but it could be different.
#
Methods#
getNamegetName(): string;
Gets the name of the vault
#
getAbstractFileByPathgetAbstractFileByPath(path: string): TAbstractFile | null;
#
getRootgetRoot(): TFolder;
#
createcreate(path: string, data: string, options?: DataWriteOptions): Promise<TFile>;
#
createBinarycreateBinary(path: string, data: ArrayBuffer, options?: DataWriteOptions): Promise<TFile>;
#
createFoldercreateFolder(path: string): Promise<void>;
#
readread(file: TFile): Promise<string>;
#
cachedReadcachedRead(file: TFile): Promise<string>;
#
readBinaryreadBinary(file: TFile): Promise<ArrayBuffer>;
#
getResourcePathgetResourcePath(file: TFile): string;
#
deletedelete(file: TAbstractFile, force?: boolean): Promise<void>;
#
trashtrash(file: TAbstractFile, system: boolean): Promise<void>;
Tries to move to system trash. If that isn't successful/allowed, use local trash
#
renamerename(file: TAbstractFile, newPath: string): Promise<void>;
#
modifymodify(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
#
modifyBinarymodifyBinary(file: TFile, data: ArrayBuffer, options?: DataWriteOptions): Promise<void>;
#
appendappend(file: TFile, data: string, options?: DataWriteOptions): Promise<void>;
#
copycopy(file: TFile, newPath: string): Promise<TFile>;
#
getAllLoadedFilesgetAllLoadedFiles(): TAbstractFile[];
#
recurseChildrenstatic recurseChildren(root: TFolder, cb: (file: TAbstractFile) => any): void;
#
getMarkdownFilesgetMarkdownFiles(): TFile[];
#
getFilesgetFiles(): TFile[];
#
onon(name: 'create', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
#
onon(name: 'modify', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
#
onon(name: 'delete', callback: (file: TAbstractFile) => any, ctx?: any): EventRef;
#
onon(name: 'rename', callback: (file: TAbstractFile, oldPath: string) => any, ctx?: any): EventRef;
#
onon(name: 'closed', callback: () => any, ctx?: any): EventRef;