<!-- Do not edit this file. It is automatically generated by API Documenter. --> [`FileManager`](FileManager) › [`processFrontMatter`](FileManager/processFrontMatter) ## FileManager.processFrontMatter() method Atomically read, modify, and save the frontmatter of a note. The frontmatter is passed in as a JS object, and should be mutated directly to achieve the desired result. Remember to handle errors thrown by this method. **Signature:** ```typescript processFrontMatter(file: TFile, fn: (frontmatter: any) => void, options?: DataWriteOptions): Promise<void>; ``` ## Parameters | Parameter | Type | Description | | --- | --- | --- | | <code>file</code> | [`TFile`](TFile) | the file to be modified. Must be a Markdown file. | | <code>fn</code> | <code>(frontmatter: any) =&gt; void</code> | a callback function which mutates the frontmatter object synchronously. | | <code>options</code> | [`DataWriteOptions`](DataWriteOptions) | _(Optional)_ write options. | **Returns:** `Promise``<void>` ## Exceptions YAMLParseError if the YAML parsing fails any errors that your callback function throws ## Example ```ts app.fileManager.processFrontMatter(file, (frontmatter) => { frontmatter['key1'] = value; delete frontmatter['key2']; }); ```