Obsidian API/Function to work with Frontmatter/File Content

I am trying to modify the content stored in files based on the results of a Templater Script. I am able to modify the content of files using app.vault.modify() but this file also gets rid of the frontmatter. I want to modify the content of the file without touching the frontmatter.

The below API seems to be what I need but I do not know how to use it. The function does not seem to be accessible using the app object in the Obsidian Developer Tools.

This command also seems to walk about this function but once again I am not able to use it from Developer tools.

How would I go about using this function/API?

import { getFrontMatterInfo } from 'obsidian'

That import doesn’t work in templater scripts. In templater, you should be able to access the function by tp.obsidian.getFrontMatterInfo