Vault โ€บ process

Vault.process() method

Atomically read, modify, and save the contents of a note.

Signature:

process(file: TFile, fn: (data: string) => string, options?: DataWriteOptions): Promise<string>;

Parameters

ParameterTypeDescription
fileTFilethe file to be read and modified.
fn(data: string) โ‡’ stringa callback function which returns the new content of the note synchronously.
optionsDataWriteOptions(Optional) write options.

Returns:

Promise<string>

string - the text value of the note that was written.

Example

app.vault.process(file, (data) => {
 return data.replace('Hello', 'World');
});