Vault.process method
Vault › process
Official
Atomically read, modify, and save the contents of a note.Signature:
process(file: TFile, fn: (data: string) => string, options?: DataWriteOptions | undefined): Promise<string>Parameters:
| Parameter | Type | Description |
|---|---|---|
| file | TFile | The file. |
| fn | (data: string) => string | A callback function which returns the new content of the note synchronously. |
| options? | DataWriteOptions | undefined | Write options. |
Returns: Promise<string> — The new content of the note.
Since: 1.1.0
Example:
await vault.process(file, (data) => { return data.replace('foo', 'bar');});