How to read and set note properties programmatically (by TypeScript)?

I am writing a plugin and I would like to read and set a frontmatter property of a note. That is, I would like some example TypeScript code. I have looked at the developer documentation, but I cannot even find out whether properties are maintained by CodeMirror or Obsidian. I can read the frontmatter using CachedMetadatabut that does let me update.

edit: FileManager.processFrontMatter?

Use FileManager.processFrontMatter